#include <bits/stdc++.h>
using namespace std;
#define PII pair<int,int>
#define mp make_pair
#define pb push_back
#define FOR(i,a,b) for (int i=(a);i<=(b);++i)
#define ROF(i,a,b) for (int i=(a);i>=(b);--i)
typedef long long ll;
inline int read(){
	int x=0,f=1; char ch=getchar();
	while (!isdigit(ch)) { if (ch=='-') f=-1; ch=getchar(); }
	while (isdigit(ch)) { x=x*10+ch-'0'; ch=getchar(); }
	return x*f;
}

const int MAXN=1000006,Mo=1e9+7;
namespace PAM{
	static const int H=26;
	int last,Slen,size;
	int nt[MAXN][H],fl[MAXN],len[MAXN],S[MAXN];
	int seriesLink[MAXN],f[MAXN],g[MAXN];
	int newnode(int l){
		FOR(i,0,H-1) nt[size][i]=0;
		len[size]=l; return size++;
	}
	inline int diff(int x){ return len[x]-len[fl[x]]; }
	void init(){
		size=last=Slen=0;
		newnode(0),newnode(-1);
		S[Slen]=-1,fl[0]=1,fl[1]=1;
		f[0]=1,g[0]=g[1]=0;
	}
	int getFail(int x){
		while (S[Slen-len[x]-1]!=S[Slen]) x=fl[x];
		return x;
	}
	inline void update(int x[],int y,int z){ if (x[0]>y) x[0]=y,x[1]=z; }
	int getSum(int x){
		int y=Slen-(len[seriesLink[x]]+diff(x));
		g[x]=f[y];
		if (diff(x)==diff(fl[x])) {
			g[x]+=g[fl[x]];
			if (g[x]>=Mo) g[x]-=Mo;
		}
		return g[x];
	}
	void add(int c){
		S[++Slen]=(c-='a');
		int cur=getFail(last);
		if (!nt[cur][c]) {
			int now=newnode(len[cur]+2);
			fl[now]=nt[getFail(fl[cur])][c],nt[cur][c]=now;
			if (diff(now)==diff(fl[now]))
				seriesLink[now]=seriesLink[fl[now]];
			else
				seriesLink[now]=fl[now];
		}
		last=nt[cur][c];
		f[Slen]=0;
		int tmp=0;
		for (int now=last;len[now]>0;now=seriesLink[now]) {
			int gS=getSum(now);
			if (!(Slen&1)) {
				tmp+=gS;
				if (tmp>=Mo) tmp-=Mo;
			}
		}
		f[Slen]=tmp;
	}
	void print(){
		FOR(i,1,Slen) putchar('a'+S[i]);
		puts("");
		FOR(i,1,Slen) printf("%d%c",f[i]," \n"[i==Slen]);
		FOR(i,0,size-1) {
			printf("%d:fail[%d]=%d,len[%d]=%d\n",i,i,fl[i],i,len[i]);
			FOR(j,0,H-1)
			if (nt[i][j]) printf("(%c%d)",'a'+j,nt[i][j]);
			puts("");
		}
	}
};
int n,m;
char s[MAXN];
int main(){
	scanf("%s",s+1); n=strlen(s+1);
	PAM::init();
	FOR(i,1,n/2) PAM::add(s[i]),PAM::add(s[n+1-i]);
	//PAM::print();
	printf("%d\n",PAM::f[n]);

	return 0;
}

/*
abcdcdab

*/


#include <bits/stdc++.h>
#define N 1<<20
using namespace std;

const int P = 1000000007;
int add(int a, int b) { int r = a + b; return r < P ? r : r - P; }
int sub(int a, int b) { int r = a - b; return r < 0 ? r + P : r; }

namespace pam {

char s[N];
int g[N][26], f[N], l[N], d[N], t[N], nc;

int dp[N], v[N];

int gn(int len) {
    int p = nc++; l[p] = len; f[p] = 0;
    fill_n(g[p], 26, 0);
    return p;
}

void clr() { nc = 0; gn(0); gn(-1); f[0] = 1; f[1] = -1; s[0] = 1; }

int getf(int p, int i) {
    while (s[i] != s[i - l[p] - 1]) p = f[p];
    return p;
}

int extend(int p, int o, int i) {
    s[i] = o + 'a'; p = getf(p, i);
    int& q = g[p][o];
    if (!q) {
        q = gn(l[p] + 2);
        if (p != 1) f[q] = g[getf(f[p], i)][o];
        d[q] = l[q] - l[f[q]];
        t[q] = d[f[q]] == d[q] ? t[f[q]] : f[q];
    }
    for (int r = q; r > 1; r = t[r]) {
        v[r] = dp[i - l[t[r]] - d[r]];
        if (d[r] == d[f[r]]) v[r] = add(v[r], v[f[r]]);
        if (i % 2 == 0) dp[i] = add(dp[i], v[r]);
    }
    return q;
}

}

int main(void) {
    ios::sync_with_stdio(0); cin.tie(0);
    #ifndef ONLINE_JUDGE
    ifstream cin("1.in");
    #endif // ONLINE_JUDGE

    string s; cin >> s;
    int n = s.size();
    string t(n, '0');
    for (int i = 0; i != n / 2; ++i) {
        t[2 * i + 1] = s[i];
        t[2 * i] = s[n - i - 1];
    }

    pam::dp[0] = 1;
    pam::clr();
    int p = 0;
    for (int i = 0; i != n; ++i)
        p = pam::extend(p, t[i] - 'a', i + 1);

    cout << pam::dp[n] << endl;

    return 0;
}


#include <bits/stdc++.h>
#define N 1<<20
using namespace std;

const int P = 1000000007;
int add(int a, int b) { int r = a + b; return r < P ? r : r - P; }
int sub(int a, int b) { int r = a - b; return r < 0 ? r + P : r; }

namespace pam {

char s[N];
int g[N][26], f[N], l[N], d[N], t[N], nc;

int dp[N], v[N];

int gn(int len) {
    int p = nc++; l[p] = len; f[p] = 0;
    fill_n(g[p], 26, 0);
    return p;
}

void clr() { nc = 0; gn(0); gn(-1); f[0] = 1; f[1] = -1; s[0] = -1; }

int getf(int p, int i) {
    while (s[i] != s[i - l[p] - 1]) p = f[p];
    return p;
}

int extend(int p, int o, int i) {
    s[i] = o + 'a'; p = getf(p, i);
    int& q = g[p][o];
    if (!q) {
        q = gn(l[p] + 2);
        if (p != 1) f[q] = g[getf(f[p], i)][o];
        d[q] = l[q] - l[f[q]];
        t[q] = d[f[q]] == d[q] ? t[f[q]] : f[q];
        for (int r = q; r > 1; r = t[r]) {
            v[r] = dp[i - l[t[r]] - d[r]];
            if (d[r] == d[f[r]]) v[r] = add(v[r], v[f[r]]);
            if (i % 2 == 0) dp[i] = add(dp[i], v[r]);
        }
    }
    return q;
}

}

int main(void) {
    ios::sync_with_stdio(0); cin.tie(0);
    #ifndef ONLINE_JUDGE
    ifstream cin("1.in");
    #endif // ONLINE_JUDGE

    string s; cin >> s;
    int n = s.size();
    string t(n, '0');
    for (int i = 0; i != n / 2; ++i) {
        t[2 * i + 1] = s[i];
        t[2 * i] = s[n - i - 1];
    }

    pam::dp[0] = 1;
    pam::clr();
    int p = 0;
    for (int i = 0; i != n; ++i)
        p = pam::extend(p, t[i] - 'a', i + 1);

    cout << pam::dp[n] << endl;

    return 0;
}


#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;

vector<int> to_palin(const string& s) {
	const unsigned mod = 3853518419;
	const unsigned base = 5489143;

	int n = s.size(), h = n/2;
	unsigned ha = 0, hb = 0, hp = 1;
	vector<string> p, q;
	for (int i=0, l=0, r=0; i<h; i++) {
		ha = (ha * 1ull * base + s[i]) % mod;
		hb = (hb + 1ull * s[n-i-1] * hp) % mod;
		hp = (hp * 1ull * base) % mod;
		r++;
		if (ha == hb) {
			p.push_back(s.substr(l, r-l));
			l = r = i+1;
			ha = hb = 0;
			hp = 1;
		}
	}
	q = p;
	sort(q.begin(), q.end());
	q.resize(unique(q.begin(), q.end()) - q.begin());
	vector<int> r(p.size());
	for (int i=0; i<(int)r.size(); i++)
		r[i] = lower_bound(q.begin(), q.end(), p[i]) - q.begin();
	return r;
}

struct triple {
	int i, d, k;
};

vector<vector<triple>> factor(vector<int> s) {
	int n = s.size();
	s.insert(s.begin(), -1);
	vector<vector<triple>> gv(n+1);
	for (int j=1; j<=n; j++) {
		vector<triple> g = gv[j-1], gp, gpp;
		for (auto [i, d, k] : g) {
			if (i > 1 && s[i-1] == s[j])
				gp.push_back({i-1, d, k});
		}
		int r = 1123123123;
		for (auto [i, d, k] : gp) {
			if (i-r != d) {
				gpp.push_back({i, i-r, 1});
				if (k > 0)
					gpp.push_back({i+d, d, k-1});
			} else {
				gpp.push_back({i, d, k});
			}
			r = i + (k-1)*d;
		}
		if (j > 1 && s[j-1] == s[j]) {
			gpp.push_back({j-1, j-1-r, 1});
			r = j-1;
		}
		gpp.push_back({j, j-r, 1});
		g.clear();
		auto [ip, dp, kp] = gpp[0];
		gpp.erase(gpp.begin());
		for (auto [i, d, k] : gpp) {
			if (dp == d) {
				kp += k;
			} else {
				g.push_back({ip, dp, kp});
				ip = i, dp = d, kp = k;
			}
		}
		g.push_back({ip, dp, kp});
		int k = 0;
		for (int i=0; i<(int)g.size(); i++)
			if (g[i].k > 0)
				g[k++] = g[i];
		g.resize(k);
		gv[j] = move(g);
	}
	for (auto& x : gv)
		for (auto& y : x)
			y.i--;
	return gv;
}

string num(int x) {
	if (x < 0)
		return "\xe2\x88\x9e";
	return to_string(x);
}

const unsigned mod = 1'000'000'007;

void ad(unsigned& x, unsigned y) {
	x += y;
	x -= (x >= mod)*mod;
}

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);
	cerr.tie(nullptr);

	string s;
	cin >> s;
	auto v = to_palin(s);
	int n = v.size();
	auto f = factor(v);
	vector<unsigned> dp(n+1);
	vector<unordered_map<int, unsigned>> store(n+1);
	dp[0] = 1;
	for (int j=1; j<=n; j++) {
		for (auto [i, d, k] : f[j]) {
			auto q = dp[i+(k-1)*d];
			ad(dp[j], q);
			if (k > 1) {
				auto& t = store[i][d];
				ad(dp[j], t);
				t += q;
			}
		}
	}
	cout << dp[n] << '\n';
}


#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;

vector<int> to_palin(const string& s) {
	const unsigned mod = 3853518419;
	const unsigned base = 5489143;

	int n = s.size(), h = n/2;
	unsigned ha = 0, hb = 0, hp = 1;
	vector<string> p, q;
	for (int i=0, l=0, r=0; i<h; i++) {
		ha = (ha * 1ull * base + s[i]) % mod;
		hb = (hb + 1ull * s[n-i-1] * hp) % mod;
		hp = (hp * 1ull * base) % mod;
		r++;
		if (ha == hb) {
			p.push_back(s.substr(l, r-l));
			l = r = i+1;
			ha = hb = 0;
			hp = 1;
		}
	}
	q = p;
	sort(q.begin(), q.end());
	q.resize(unique(q.begin(), q.end()) - q.begin());
	vector<int> r(p.size());
	for (int i=0; i<(int)r.size(); i++)
		r[i] = lower_bound(q.begin(), q.end(), p[i]) - q.begin();
	return r;
}

struct triple {
	int i, d, k;
};

vector<vector<triple>> factor(vector<int> s) {
	int n = s.size();
	s.insert(s.begin(), -1);
	vector<vector<triple>> gv(n+1);
	for (int j=1; j<=n; j++) {
		vector<triple> g = gv[j-1], gp, gpp;
		for (auto [i, d, k] : g) {
			if (i > 1 && s[i-1] == s[j])
				gp.push_back({i-1, d, k});
		}
		int r = 1123123123;
		for (auto [i, d, k] : gp) {
			if (i-r != d) {
				gpp.push_back({i, i-r, 1});
				if (k > 0)
					gpp.push_back({i+d, d, k-1});
			} else {
				gpp.push_back({i, d, k});
			}
			r = i + (k-1)*d;
		}
		if (j > 1 && s[j-1] == s[j]) {
			gpp.push_back({j-1, j-1-r, 1});
			r = j-1;
		}
		gpp.push_back({j, j-r, 1});
		g.clear();
		auto [ip, dp, kp] = gpp[0];
		gpp.erase(gpp.begin());
		for (auto [i, d, k] : gpp) {
			if (dp == d) {
				kp += k;
			} else {
				g.push_back({ip, dp, kp});
				ip = i, dp = d, kp = k;
			}
		}
		g.push_back({ip, dp, kp});
		int k = 0;
		for (int i=0; i<(int)g.size(); i++)
			if (g[i].k > 0)
				g[k++] = g[i];
		g.resize(k);
		gv[j] = move(g);
	}
	for (auto& x : gv)
		for (auto& y : x)
			y.i--;
	return gv;
}

string num(int x) {
	if (x < 0)
		return "\xe2\x88\x9e";
	return to_string(x);
}

const unsigned mod = 1'000'000'007;

void ad(unsigned& x, unsigned y) {
	x += y;
	x -= (x >= mod)*mod;
}

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);
	cerr.tie(nullptr);

	string s;
	cin >> s;
	auto v = to_palin(s);
	int n = v.size();
	if (n == 0) {
		cout << "0\n";
		return 0;
	}
	auto f = factor(v);
	vector<unsigned> dp(n+1);
	vector<unordered_map<int, unsigned>> store(n+1);
	dp[0] = 1;
	for (int j=1; j<=n; j++) {
		for (auto [i, d, k] : f[j]) {
			auto q = dp[i+(k-1)*d];
			ad(dp[j], q);
			if (k > 1) {
				auto& t = store[i][d];
				ad(dp[j], t);
				t += q;
			}
		}
	}
	cout << dp[n] << '\n';
}


#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;

vector<int> to_palin(const string& s) {
	const unsigned mod = 3853518419;
	const unsigned base = 5489143;

	int n = s.size(), h = n/2;
	unsigned ha = 0, hb = 0, hp = 1;
	vector<string> p, q;
	for (int i=0, l=0, r=0; i<h; i++) {
		ha = (ha * 1ull * base + s[i]) % mod;
		hb = (hb + 1ull * s[n-i-1] * hp) % mod;
		hp = (hp * 1ull * base) % mod;
		r++;
		if (ha == hb) {
			p.push_back(s.substr(l, r-l));
			l = r = i+1;
			ha = hb = 0;
			hp = 1;
		}
	}
	q = p;
	sort(q.begin(), q.end());
	q.resize(unique(q.begin(), q.end()) - q.begin());
	vector<int> r(p.size());
	for (int i=0; i<(int)r.size(); i++)
		r[i] = lower_bound(q.begin(), q.end(), p[i]) - q.begin();
	return r;
}

struct triple {
	int i, d, k;
};

vector<vector<triple>> factor(vector<int> s) {
	int n = s.size();
	s.insert(s.begin(), -1);
	vector<vector<triple>> gv(n+1);
	for (int j=1; j<=n; j++) {
		vector<triple> g = gv[j-1], gp, gpp;
		for (auto [i, d, k] : g) {
			if (i > 1 && s[i-1] == s[j])
				gp.push_back({i-1, d, k});
		}
		int r = 1123123123;
		for (auto [i, d, k] : gp) {
			if (i-r != d) {
				gpp.push_back({i, i-r, 1});
				if (k > 0)
					gpp.push_back({i+d, d, k-1});
			} else {
				gpp.push_back({i, d, k});
			}
			r = i + (k-1)*d;
		}
		if (j > 1 && s[j-1] == s[j]) {
			gpp.push_back({j-1, j-1-r, 1});
			r = j-1;
		}
		gpp.push_back({j, j-r, 1});
		g.clear();
		auto [ip, dp, kp] = gpp[0];
		gpp.erase(gpp.begin());
		for (auto [i, d, k] : gpp) {
			if (dp == d) {
				kp += k;
			} else {
				g.push_back({ip, dp, kp});
				ip = i, dp = d, kp = k;
			}
		}
		g.push_back({ip, dp, kp});
		int k = 0;
		for (int i=0; i<(int)g.size(); i++)
			if (g[i].k > 0)
				g[k++] = g[i];
		g.resize(k);
		gv[j] = move(g);
	}
	for (auto& x : gv)
		for (auto& y : x)
			y.i--;
	return gv;
}

string num(int x) {
	if (x < 0)
		return "\xe2\x88\x9e";
	return to_string(x);
}

const unsigned mod = 1'000'000'007;

void ad(unsigned& x, unsigned y) {
	x += y;
	x -= (x >= mod)*mod;
}

ull ht(int x, int y, int z) {
	return 810729873427428ull * x + 84237947198341ull * y
		+ 8673148763467452782ull * z;
}

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);
	cerr.tie(nullptr);

	string s;
	cin >> s;
	auto v = to_palin(s);
	int n = v.size();
	if (n == 0) {
		cout << "0\n";
		return 0;
	}
	// for (int x : v)
	// 	cerr << (char)('a'+x) << ' ';
	auto f = factor(v);
	vector<unsigned> dp(n+1);
	unordered_map<ull, unsigned> store;
	dp[0] = 1;
	for (int j=1; j<=n; j++) {
		for (auto [i, d, k] : f[j]) {
			// cerr << "[" << i << ' ' << d << ' ' << k << "] ";

			int kk = k;
			unsigned v = 0;
			while (kk > 0 && !store.count(ht(i, d, kk))) {
				ad(v, dp[i+(kk-1)*d]);
				kk--;
			}
			if (kk > 0) {
				ad(v, store[ht(i, d, kk)]);
			}
			if (d > 0) {
				store[ht(i, d, k)] = v;
			}
			ad(dp[j], v);
		}
		cerr << '\n';
	}
	cout << dp[n] << '\n';
}


#include<iostream>
#include<algorithm>
#define ll long long
using namespace std;
const int maxn = 1100000;
const int mod = 1e9 + 7;
int n, m;
char S[maxn]; int str[maxn];
int id[maxn], f[maxn], g[maxn];
struct pTree
{
	int fail[maxn], trans[maxn][26], diff[maxn], nxt[maxn], len[maxn];
	int cnt, last;
	void init()
	{
		cnt = 1; last = 0;
		memset(trans[0], 0, sizeof trans[0]);
		memset(trans[1], 0, sizeof trans[1]);
		len[0] = 0, len[1] = -1;
		fail[0] = 1;
	}
	int newnode(int l)
	{
		++cnt;
		memset(trans[cnt], 0, sizeof trans[cnt]);
		len[cnt] = l;
		return cnt;
	}
	int extend(int i)
	{
		int p = last, np, w = str[i];
		while (str[i - len[p] - 1] != str[i]) p = fail[p];
		if (!trans[p][w])
		{
			np = newnode(len[p] + 2);
			int t = fail[p];
			while (str[i - len[t] - 1] != str[i]) t = fail[t];
			fail[np] = trans[t][w];

			diff[np] = len[np] - len[fail[np]];
			if (diff[np] == diff[fail[np]]) nxt[np] = nxt[fail[np]];
			else nxt[np] = fail[np];

			trans[p][w] = np;
		}
		else np = trans[p][w];
		return last = np;
	}
}tr;
int main()
{
	scanf("%s", S); n = strlen(S);
	if (n & 1) return puts("0"), 0;
	str[m = 0] = -1;
	for (int i = 0; i<n / 2; i++) str[++m] = S[i] - 'a', str[++m] = S[n - i - 1] - 'a';
	tr.init();
	for (int i = 1; i <= m; i++) id[i] = tr.extend(i);
	f[0] = 1;
	for (int i = 1; i <= m; i++)
	{
		for (int p = id[i]; p; p = tr.nxt[p])
		{
			g[p] = f[i - tr.len[tr.nxt[p]] - tr.diff[p]];
			if (tr.diff[p] == tr.diff[tr.fail[p]]) (g[p] += g[tr.fail[p]]) %= mod;
			if (!(i & 1)) (f[i] += g[p]) %= mod;
		}
	}
	printf("%d\n", f[n]);
	return 0;
}


#include<set>
#include<map>
#include<deque>
#include<queue>
#include<stack>
#include<cmath>
#include<ctime>
#include<bitset>
#include<string>
#include<vector>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<climits>
#include<complex>
#include<iostream>
#include<algorithm>
#define ll long long
using namespace std;
const int maxn = 1100000;
const int mod = 1e9 + 7;
int n, m;
char S[maxn]; int str[maxn];
int id[maxn], f[maxn], g[maxn];
struct pTree
{
	int fail[maxn], trans[maxn][26], diff[maxn], nxt[maxn], len[maxn];
	int cnt, last;
	void init()
	{
		cnt = 1; last = 0;
		memset(trans[0], 0, sizeof trans[0]);
		memset(trans[1], 0, sizeof trans[1]);
		len[0] = 0, len[1] = -1;
		fail[0] = 1;
	}
	int newnode(int l)
	{
		++cnt;
		memset(trans[cnt], 0, sizeof trans[cnt]);
		len[cnt] = l;
		return cnt;
	}
	int extend(int i)
	{
		int p = last, np, w = str[i];
		while (str[i - len[p] - 1] != str[i]) p = fail[p];
		if (!trans[p][w])
		{
			np = newnode(len[p] + 2);
			int t = fail[p];
			while (str[i - len[t] - 1] != str[i]) t = fail[t];
			fail[np] = trans[t][w];
			diff[np] = len[np] - len[fail[np]];
			if (diff[np] == diff[fail[np]]) nxt[np] = nxt[fail[np]];
			else nxt[np] = fail[np];

			trans[p][w] = np;
		}
		else np = trans[p][w];
		return last = np;
	}
}tr;
int main()
{
	scanf("%s", S); n = strlen(S);
	if (n & 1) return puts("0"), 0;
	str[m = 0] = -1;
	for (int i = 0; i<n / 2; i++) str[++m] = S[i] - 'a', str[++m] = S[n - i - 1] - 'a';
	tr.init();
	for (int i = 1; i <= m; i++) id[i] = tr.extend(i);
	f[0] = 1;
	for (int i = 1; i <= m; i++)
	{
		for (int p = id[i]; p; p = tr.nxt[p])
		{
			g[p] = f[i - tr.len[tr.nxt[p]] - tr.diff[p]];
			if (tr.diff[p] == tr.diff[tr.fail[p]]) (g[p] += g[tr.fail[p]]) %= mod;
			if (!(i & 1)) (f[i] += g[p]) %= mod;
		}
	}
	printf("%d\n", f[n]);
	return 0;
}


#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <ctime>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
typedef long long ll;
typedef unsigned long long ull;
typedef long double LD;
using namespace std;
const int INF = 2147483647;
const int INF2 = 0x3f3f3f3f;
const ll INF64 = 1e18;
const double INFD = 1e30;
const double EPS = 1e-6;
const double PI = 3.14159265;
const ll MOD = 998244353;
template <typename T>
inline T read() {
    T X = 0, w = 0;
    char ch = 0;
    while (!isdigit(ch)) {
        w |= ch == '-';
        ch = getchar();
    }
    while (isdigit(ch)) X = (X << 3) + (X << 1) + (ch ^ 48), ch = getchar();
    return w ? -X : X;
}
const int MAXN = 200005;
int n, m, k;
int dr[4] = {1, 0, -1, 0};
int dc[4] = {0, 1, 0, -1};
int dr2[8] = {1, 1, 1, -1, -1, -1, 0, 0};
int dc2[8] = {1, 0, -1, 1, 0, -1, 1, -1};
int CASE;

int arr[MAXN];
map<ll, ll> factorize(ll x) {
    map<ll, ll> pcnt;
    for (ll i = 2; i * i <= x; i++) {
        if (x % i == 0) {
            int cnt = 0;
            while (x % i == 0) cnt++, x /= i;
            pcnt[i] = cnt;
        }
    }
    if (x > 1) pcnt[x] = 1;
    return pcnt;
}
void solve() {
    scanf("%d", &n);
    ll sum = 0;
    ll xors = 0;
    for (int i = 0; i < n; i++) {
        scanf("%d", &arr[i]);
        sum += arr[i];
        xors ^= arr[i];
    }
    if (2 * xors == sum) {
        printf("0\n\n");
        return;
    }
    ll y1 = sum & 1;
    ll y = (((1LL << 31LL) - 1LL) ^ xors);
    if (y1) {
        y |= 1;
    } else {
        y &= ~0 << 1;
    }
    ll i = 32LL;
    ll z = y ^ xors;
    while (2LL * (xors ^ y) < sum - y) {
        y = (((1LL << i) - 1LL) ^ xors);
        if (y1) {
            y |= 1;
        } else {
            y &= ~0 << 1;
        }
        ++i;
    }
    xors ^= y;
    xors *= 2LL;
    xors -= sum;
    xors -= y;
    ll x = xors / 2LL;
    printf("3\n");
    printf("%lld %lld %lld\n", x, x, y);
}

int main() {
#ifdef LOCALLL
    freopen("in", "r", stdin);
    freopen("out", "w", stdout);
#endif
    int T;
    scanf("%d", &T);
    while (T--) {
        solve();
    }
    return 0;
}


#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <ctime>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
typedef long long ll;
typedef unsigned long long ull;
typedef long double LD;
using namespace std;
const int INF = 2147483647;
const int INF2 = 0x3f3f3f3f;
const ll INF64 = 1e18;
const double INFD = 1e30;
const double EPS = 1e-6;
const double PI = 3.14159265;
const ll MOD = 998244353;
template <typename T>
inline T read() {
    T X = 0, w = 0;
    char ch = 0;
    while (!isdigit(ch)) {
        w |= ch == '-';
        ch = getchar();
    }
    while (isdigit(ch)) X = (X << 3) + (X << 1) + (ch ^ 48), ch = getchar();
    return w ? -X : X;
}
const int MAXN = 200005;
int n, m, k;
int dr[4] = {1, 0, -1, 0};
int dc[4] = {0, 1, 0, -1};
int dr2[8] = {1, 1, 1, -1, -1, -1, 0, 0};
int dc2[8] = {1, 0, -1, 1, 0, -1, 1, -1};
int CASE;

int arr[MAXN];
map<ll, ll> factorize(ll x) {
    map<ll, ll> pcnt;
    for (ll i = 2; i * i <= x; i++) {
        if (x % i == 0) {
            int cnt = 0;
            while (x % i == 0) cnt++, x /= i;
            pcnt[i] = cnt;
        }
    }
    if (x > 1) pcnt[x] = 1;
    return pcnt;
}
void solve() {
    scanf("%d", &n);
    ll sum = 0;
    ll xors = 0;
    for (int i = 0; i < n; i++) {
        scanf("%d", &arr[i]);
        sum += arr[i];
        xors ^= arr[i];
    }
    if (2 * xors == sum) {
        printf("0\n\n");
        return;
    }
    ll y = 0;
    if (sum & 1) {
        y = 1;
    }
    y = (sum << 1LL) | y;
    xors ^= y;
    xors *= 2LL;
    xors -= sum;
    xors -= y;
    ll x = xors / 2LL;
    printf("3\n");
    printf("%lld %lld %lld\n", x, x, y);
}

int main() {
#ifdef LOCALLL
    freopen("in", "r", stdin);
    freopen("out", "w", stdout);
#endif
    int T;
    scanf("%d", &T);
    while (T--) {
        solve();
    }
    return 0;
}


#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <ctime>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
typedef long long ll;
typedef unsigned long long ull;
typedef long double LD;
using namespace std;
const int INF = 2147483647;
const int INF2 = 0x3f3f3f3f;
const ll INF64 = 1e18;
const double INFD = 1e30;
const double EPS = 1e-6;
const double PI = 3.14159265;
const ll MOD = 998244353;
template <typename T>
inline T read() {
    T X = 0, w = 0;
    char ch = 0;
    while (!isdigit(ch)) {
        w |= ch == '-';
        ch = getchar();
    }
    while (isdigit(ch)) X = (X << 3) + (X << 1) + (ch ^ 48), ch = getchar();
    return w ? -X : X;
}
const int MAXN = 200005;
int n, m, k;
int dr[4] = {1, 0, -1, 0};
int dc[4] = {0, 1, 0, -1};
int dr2[8] = {1, 1, 1, -1, -1, -1, 0, 0};
int dc2[8] = {1, 0, -1, 1, 0, -1, 1, -1};
int CASE;

int arr[MAXN];
map<ll, ll> factorize(ll x) {
    map<ll, ll> pcnt;
    for (ll i = 2; i * i <= x; i++) {
        if (x % i == 0) {
            int cnt = 0;
            while (x % i == 0) cnt++, x /= i;
            pcnt[i] = cnt;
        }
    }
    if (x > 1) pcnt[x] = 1;
    return pcnt;
}
void solve() {
    scanf("%d", &n);
    ll sum = 0;
    ll xors = 0;
    for (int i = 0; i < n; i++) {
        scanf("%d", &arr[i]);
        sum += arr[i];
        xors ^= arr[i];
    }
    if (2LL * xors == sum) {
        printf("0\n\n");
        return;
    }
    vector<ll> ans;
    if (sum & 1) {
        ans.push_back(1);
        sum++;
        xors ^= 1;
    }
    if (xors * 2LL > sum) {
        ll s = (xors * 2LL - sum) / 2;
        ans.push_back(s);
        ans.push_back(s);
    } else {
        ans.push_back(xors);
        ans.push_back(sum + xors);
    }
    printf("%d\n", ans.size());
    for (auto a : ans) {
        printf("%lld ", a);
    }
    printf("\n");
}

int main() {
#ifdef LOCALLL
    freopen("in", "r", stdin);
    freopen("out", "w", stdout);
#endif
    int T;
    scanf("%d", &T);
    while (T--) {
        solve();
    }
    return 0;
}


#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <ctime>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
typedef long long ll;
typedef unsigned long long ull;
typedef long double LD;
using namespace std;
const int INF = 2147483647;
const int INF2 = 0x3f3f3f3f;
const ll INF64 = 1e18;
const double INFD = 1e30;
const double EPS = 1e-6;
const double PI = 3.14159265;
const ll MOD = 998244353;
template <typename T>
inline T read() {
    T X = 0, w = 0;
    char ch = 0;
    while (!isdigit(ch)) {
        w |= ch == '-';
        ch = getchar();
    }
    while (isdigit(ch)) X = (X << 3) + (X << 1) + (ch ^ 48), ch = getchar();
    return w ? -X : X;
}
const int MAXN = 200005;
int n, m, k;
int dr[4] = {1, 0, -1, 0};
int dc[4] = {0, 1, 0, -1};
int dr2[8] = {1, 1, 1, -1, -1, -1, 0, 0};
int dc2[8] = {1, 0, -1, 1, 0, -1, 1, -1};
int CASE;

int arr[MAXN];
map<ll, ll> factorize(ll x) {
    map<ll, ll> pcnt;
    for (ll i = 2; i * i <= x; i++) {
        if (x % i == 0) {
            int cnt = 0;
            while (x % i == 0) cnt++, x /= i;
            pcnt[i] = cnt;
        }
    }
    if (x > 1) pcnt[x] = 1;
    return pcnt;
}
void solve() {
    scanf("%d", &n);
    ll sum = 0;
    ll xors = 0;
    for (int i = 0; i < n; i++) {
        scanf("%d", &arr[i]);
        sum += arr[i];
        xors ^= arr[i];
    }
    if (2 * xors == sum) {
        printf("0\n\n");
        return;
    }
    ll y1 = 0;
    if (sum & 1) {
        y1 = 1;
    }
    ll y = y1;
    ll i = 1;
    while (2LL * (xors ^ y) < sum + y) {
        y |= (1 << i);
    }
    xors ^= y;
    xors *= 2LL;
    xors -= sum;
    xors -= y;
    ll x = xors / 2LL;
    printf("3\n");
    printf("%lld %lld %lld\n", x, x, y);
}

int main() {
#ifdef LOCALLL
    freopen("in", "r", stdin);
    freopen("out", "w", stdout);
#endif
    int T;
    scanf("%d", &T);
    while (T--) {
        solve();
    }
    return 0;
}


#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <ctime>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
typedef long long ll;
typedef unsigned long long ull;
typedef long double LD;
using namespace std;
const int INF = 2147483647;
const int INF2 = 0x3f3f3f3f;
const ll INF64 = 1e18;
const double INFD = 1e30;
const double EPS = 1e-6;
const double PI = 3.14159265;
const ll MOD = 998244353;
template <typename T>
inline T read() {
    T X = 0, w = 0;
    char ch = 0;
    while (!isdigit(ch)) {
        w |= ch == '-';
        ch = getchar();
    }
    while (isdigit(ch)) X = (X << 3) + (X << 1) + (ch ^ 48), ch = getchar();
    return w ? -X : X;
}
const int MAXN = 200005;
int n, m, k;
int dr[4] = {1, 0, -1, 0};
int dc[4] = {0, 1, 0, -1};
int dr2[8] = {1, 1, 1, -1, -1, -1, 0, 0};
int dc2[8] = {1, 0, -1, 1, 0, -1, 1, -1};
int CASE;

int arr[MAXN];
map<ll, ll> factorize(ll x) {
    map<ll, ll> pcnt;
    for (ll i = 2; i * i <= x; i++) {
        if (x % i == 0) {
            int cnt = 0;
            while (x % i == 0) cnt++, x /= i;
            pcnt[i] = cnt;
        }
    }
    if (x > 1) pcnt[x] = 1;
    return pcnt;
}
void solve() {
    scanf("%d", &n);
    ll sum = 0;
    ll xors = 0;
    for (int i = 0; i < n; i++) {
        scanf("%d", &arr[i]);
        sum += arr[i];
        xors ^= arr[i];
    }
    if (2 * xors == sum) {
        printf("0\n\n");
        return;
    }
    ll y = 0;
    if (sum & 1) {
        y = 1;
    }
    y = sum << 1 | y;
    xors ^= y;
    xors *= 2;
    xors -= sum;
    xors -= y;
    int x = xors / 2;
    printf("3\n");
    printf("%d %d %d\n", x, x, y);
}

int main() {
#ifdef LOCALLL
    freopen("in", "r", stdin);
    freopen("out", "w", stdout);
#endif
    int T;
    scanf("%d", &T);
    while (T--) {
        solve();
    }
    return 0;
}


#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <ctime>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
typedef long long ll;
typedef unsigned long long ull;
typedef long double LD;
using namespace std;
const int INF = 2147483647;
const int INF2 = 0x3f3f3f3f;
const ll INF64 = 1e18;
const double INFD = 1e30;
const double EPS = 1e-6;
const double PI = 3.14159265;
const ll MOD = 998244353;
template <typename T>
inline T read() {
    T X = 0, w = 0;
    char ch = 0;
    while (!isdigit(ch)) {
        w |= ch == '-';
        ch = getchar();
    }
    while (isdigit(ch)) X = (X << 3) + (X << 1) + (ch ^ 48), ch = getchar();
    return w ? -X : X;
}
const int MAXN = 200005;
int n, m, k;
int dr[4] = {1, 0, -1, 0};
int dc[4] = {0, 1, 0, -1};
int dr2[8] = {1, 1, 1, -1, -1, -1, 0, 0};
int dc2[8] = {1, 0, -1, 1, 0, -1, 1, -1};
int CASE;

int arr[MAXN];
map<ll, ll> factorize(ll x) {
    map<ll, ll> pcnt;
    for (ll i = 2; i * i <= x; i++) {
        if (x % i == 0) {
            int cnt = 0;
            while (x % i == 0) cnt++, x /= i;
            pcnt[i] = cnt;
        }
    }
    if (x > 1) pcnt[x] = 1;
    return pcnt;
}
void solve() {
    scanf("%d", &n);
    ll sum = 0;
    ll xors = 0;
    for (int i = 0; i < n; i++) {
        scanf("%d", &arr[i]);
        sum += arr[i];
        xors ^= arr[i];
    }
    if (2 * xors == sum) {
        printf("0\n\n");
        return;
    }
    ll y1 = sum & 1;
    ll y = ((1LL << 32LL) - 1LL) ^ xors | y1;
    ll i = 33;
    while (2 * (xors ^ y) < sum - y) {
        y = ((1LL << i) - 1LL) ^ xors | y1;
        ++i;
    }
    xors ^= y;
    xors *= 2LL;
    xors -= sum;
    xors -= y;
    ll x = xors / 2LL;
    printf("3\n");
    printf("%lld %lld %lld\n", x, x, y);
}

int main() {
#ifdef LOCALLL
    freopen("in", "r", stdin);
    freopen("out", "w", stdout);
#endif
    int T;
    scanf("%d", &T);
    while (T--) {
        solve();
    }
    return 0;
}


#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <ctime>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
typedef long long ll;
typedef unsigned long long ull;
typedef long double LD;
using namespace std;
const int INF = 2147483647;
const int INF2 = 0x3f3f3f3f;
const ll INF64 = 1e18;
const double INFD = 1e30;
const double EPS = 1e-6;
const double PI = 3.14159265;
const ll MOD = 998244353;
template <typename T>
inline T read() {
    T X = 0, w = 0;
    char ch = 0;
    while (!isdigit(ch)) {
        w |= ch == '-';
        ch = getchar();
    }
    while (isdigit(ch)) X = (X << 3) + (X << 1) + (ch ^ 48), ch = getchar();
    return w ? -X : X;
}
const int MAXN = 200005;
int n, m, k;
int dr[4] = {1, 0, -1, 0};
int dc[4] = {0, 1, 0, -1};
int dr2[8] = {1, 1, 1, -1, -1, -1, 0, 0};
int dc2[8] = {1, 0, -1, 1, 0, -1, 1, -1};
int CASE;

int arr[MAXN];
map<ll, ll> factorize(ll x) {
    map<ll, ll> pcnt;
    for (ll i = 2; i * i <= x; i++) {
        if (x % i == 0) {
            int cnt = 0;
            while (x % i == 0) cnt++, x /= i;
            pcnt[i] = cnt;
        }
    }
    if (x > 1) pcnt[x] = 1;
    return pcnt;
}
void solve() {
    scanf("%d", &n);
    ll sum = 0;
    ll xors = 0;
    for (int i = 0; i < n; i++) {
        scanf("%d", &arr[i]);
        sum += arr[i];
        xors ^= arr[i];
    }
    if (2 * xors == sum) {
        printf("0\n\n");
        return;
    }
    ll y1 = 0;
    if (sum & 1) {
        y1 = 1;
    }
    ll y = y1;
    ll i = 1;
    while (2LL * (xors ^ y) < sum + y) {
        if (y < xors) {
            if ((xors >> i) & 1 == 1) continue;
        }
        y |= (1LL << i);
        i++;
    }
    xors ^= y;
    xors *= 2LL;
    xors -= sum;
    xors -= y;
    ll x = xors / 2LL;
    printf("3\n");
    printf("%lld %lld %lld\n", x, x, y);
}

int main() {
#ifdef LOCALLL
    freopen("in", "r", stdin);
    freopen("out", "w", stdout);
#endif
    int T;
    scanf("%d", &T);
    while (T--) {
        solve();
    }
    return 0;
}


#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <ctime>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
typedef long long ll;
typedef unsigned long long ull;
typedef long double LD;
using namespace std;
const int INF = 2147483647;
const int INF2 = 0x3f3f3f3f;
const ll INF64 = 1e18;
const double INFD = 1e30;
const double EPS = 1e-6;
const double PI = 3.14159265;
const ll MOD = 998244353;
template <typename T>
inline T read() {
    T X = 0, w = 0;
    char ch = 0;
    while (!isdigit(ch)) {
        w |= ch == '-';
        ch = getchar();
    }
    while (isdigit(ch)) X = (X << 3) + (X << 1) + (ch ^ 48), ch = getchar();
    return w ? -X : X;
}
const int MAXN = 200005;
int n, m, k;
int dr[4] = {1, 0, -1, 0};
int dc[4] = {0, 1, 0, -1};
int dr2[8] = {1, 1, 1, -1, -1, -1, 0, 0};
int dc2[8] = {1, 0, -1, 1, 0, -1, 1, -1};
int CASE;

int arr[MAXN];
map<ll, ll> factorize(ll x) {
    map<ll, ll> pcnt;
    for (ll i = 2; i * i <= x; i++) {
        if (x % i == 0) {
            int cnt = 0;
            while (x % i == 0) cnt++, x /= i;
            pcnt[i] = cnt;
        }
    }
    if (x > 1) pcnt[x] = 1;
    return pcnt;
}
void solve() {
    scanf("%d", &n);
    ll sum = 0;
    ll xors = 0;
    for (int i = 0; i < n; i++) {
        scanf("%d", &arr[i]);
        sum += arr[i];
        xors ^= arr[i];
    }
    if (2 * xors == sum) {
        printf("0\n\n");
        return;
    }
    ll y = 0;
    if (sum & 1) {
        y = 1;
    }
    y = (sum << 32LL) | y;
    xors ^= y;
    xors *= 2LL;
    xors -= sum;
    xors -= y;
    ll x = xors / 2LL;
    printf("3\n");
    printf("%lld %lld %lld\n", x, x, y);
}

int main() {
#ifdef LOCALLL
    freopen("in", "r", stdin);
    freopen("out", "w", stdout);
#endif
    int T;
    scanf("%d", &T);
    while (T--) {
        solve();
    }
    return 0;
}


#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <ctime>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
typedef long long ll;
typedef unsigned long long ull;
typedef long double LD;
using namespace std;
const int INF = 2147483647;
const int INF2 = 0x3f3f3f3f;
const ll INF64 = 1e18;
const double INFD = 1e30;
const double EPS = 1e-6;
const double PI = 3.14159265;
const ll MOD = 998244353;
template <typename T>
inline T read() {
    T X = 0, w = 0;
    char ch = 0;
    while (!isdigit(ch)) {
        w |= ch == '-';
        ch = getchar();
    }
    while (isdigit(ch)) X = (X << 3) + (X << 1) + (ch ^ 48), ch = getchar();
    return w ? -X : X;
}
const int MAXN = 200005;
int n, m, k;
int dr[4] = {1, 0, -1, 0};
int dc[4] = {0, 1, 0, -1};
int dr2[8] = {1, 1, 1, -1, -1, -1, 0, 0};
int dc2[8] = {1, 0, -1, 1, 0, -1, 1, -1};
int CASE;

int arr[MAXN];
map<ll, ll> factorize(ll x) {
    map<ll, ll> pcnt;
    for (ll i = 2; i * i <= x; i++) {
        if (x % i == 0) {
            int cnt = 0;
            while (x % i == 0) cnt++, x /= i;
            pcnt[i] = cnt;
        }
    }
    if (x > 1) pcnt[x] = 1;
    return pcnt;
}
void solve() {
    scanf("%d", &n);
    ll sum = 0;
    ll xors = 0;
    for (int i = 0; i < n; i++) {
        scanf("%d", &arr[i]);
        sum += arr[i];
        xors ^= arr[i];
    }
    if (2LL * xors == sum) {
        printf("0\n\n");
        return;
    }
    vector<ll> ans;
    if (sum & 1) {
        ans.push_back(1);
        sum++;
        xors ^= 1;
    }
    if (xors * 2LL > sum) {
        ll s = (xors * 2LL - sum) / 2;
        ans.push_back(s);
        ans.push_back(s);
    } else {
        ans.push_back(xors);
        ans.push_back(sum);
    }
    printf("%d\n", ans.size());
    for (auto a : ans) {
        printf("%lld ", a);
    }
    printf("\n");
}

int main() {
#ifdef LOCALLL
    freopen("in", "r", stdin);
    freopen("out", "w", stdout);
#endif
    int T;
    scanf("%d", &T);
    while (T--) {
        solve();
    }
    return 0;
}


#include<iostream>
using namespace std;
int a[(int)1e5+10];

int main(void)
{
    int t;
    cin >> t;
    while(t--)
    {
        int n;
        cin >> n;
        cin >> a[0];
        int ans = a[0];
        int sum = a[0];
        for (int i = 1; i < n;i++)
        {
            cin >> a[i];
            ans = ans ^ a[i];
            sum += a[i];
        }
        int x,y;
        for (x = 0; 1;x++)
        {
            if(sum+x<=2*(ans^x)&&(2*(ans^x)-sum-x)%2==0)
            {
                y = (2 * (ans ^ x) - sum - x) / 2;
                break;
            }
        }
        if(x==y&&x==0)
            cout << 0 << endl
                 << endl;
        else if(x == 0)
            cout << 2 << '\n'
                 << y << " " << y << endl;
        else if(y==0)
            cout << 1 << '\n'
                 << x << endl;
        else
            cout << 3 << '\n'
                 << x << " " << y << " " << y << endl;

    }
    return 0;
}


#include<iostream>
using namespace std;
int a[(int)1e5+10];

int main(void)
{
    int t;
    cin >> t;
    while(t--)
    {
        int n;
        cin >> n;
        cin >> a[0];
        int ans = a[0];
        long long sum = a[0];
        for (int i = 1; i < n;i++)
        {
            cin >> a[i];
            ans = ans ^ a[i];
            sum += a[i];
        }
        if(sum==2*ans)
        {
            cout << 0 << endl<<endl;
            continue;
        }

        cout << 2 << endl;
        cout << ans << " " << sum + ans << endl;

    }
    return 0;
}


#include<iostream>
using namespace std;
int a[(int)1e5+10];

int main(void)
{
    int t;
    cin >> t;
    while(t--)
    {
        int n;
        cin >> n;
        cin >> a[0];
        int ans = a[0];
        int sum = a[0];
        for (int i = 1; i < n;i++)
        {
            cin >> a[i];
            ans = ans ^ a[i];
            sum += a[i];
        }
        int x,y;
        if(sum%2==0)
            x = 0;
        else
            x = 1;
        for (; 1;x+=2)
        {
            if(sum+x<=2*(ans^x)&&(2*(ans^x)-sum-x)%2==0)
            {
                y = (2 * (ans ^ x) - sum - x) / 2;
                break;
            }
        }
        if(x==y&&x==0)
            cout << 0 << endl
                 << endl;
        else if(x == 0)
            cout << 2 << '\n'
                 << y << " " << y << endl;
        else if(y==0)
            cout << 1 << '\n'
                 << x << endl;
        else
            cout << 3 << '\n'
                 << x << " " << y << " " << y << endl;

    }
    return 0;
}


#include<iostream>
using namespace std;
int a[(int)1e5+10];

int main(void)
{
    int t;
    cin >> t;
    while(t--)
    {
        int n;
        cin >> n;
        cin >> a[0];
        int ans = a[0];
        int sum = a[0];
        for (int i = 1; i < n;i++)
        {
            cin >> a[i];
            ans = ans ^ a[i];
            sum += a[i];
        }
        if(sum==2*ans)
            continue;
        cout << 2 << endl;
        cout << ans << " " << sum + ans << endl;

    }
    return 0;
}


#include<iostream>
using namespace std;
int a[(int)1e5+10];

int main(void)
{
    int t;
    cin >> t;
    while(t--)
    {
        int n;
        cin >> n;
        cin >> a[0];
        int ans = a[0];
        int sum = a[0];
        for (int i = 1; i < n;i++)
        {
            cin >> a[i];
            ans = ans ^ a[i];
            sum += a[i];
        }
        if(sum==2*ans)
        {
            cout << 0 << endl<<endl;
            continue;
        }

        cout << 2 << endl;
        cout << ans << " " << sum + ans << endl;

    }
    return 0;
}


#include <iostream>
#include <sstream>
#include <iomanip>
#include <algorithm>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <vector>
#include <string>
#include <cstring>
#include <cmath>
#include <cstdio>
#define all(v) (v).begin(), (v).end()
#define pii pair<int, int>
#define pll pair<ll, ll>
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define test cerr << '!' << endl;
using namespace std;

typedef long long ll;
typedef unsigned long long ull;

int main0 ();
int main () {
	#ifndef ONLINE_JUDGE
		freopen("C:\\Users\\98497\\Desktop\\code\\file.in", "r", stdin);
	#endif
	ios::sync_with_stdio(false);
	// clock_t start,end;
	// start = clock();
	main0();
	// end = clock();
	// cout << (end - start) << endl;
	#ifndef ONLINE_JUDGE
		fclose(stdin);
	#endif
	return 0;
}

const int INF = 0x3f3f3f3f;
const int N = 1e6;
const int M = 1e5;
const int mod = 1e9 + 7;

int a[N];

int main0 () {
	int T;
	cin >> T;
	while (T--) {
		int n;
		cin >> n;
		ll sum = 0, sub = 0;
		for (int i = 1;i <= n;i++) {
			cin >> a[i];
			sub += ((sum + a[i]) - (sum ^ a[i]));
			sum ^= a[i];
		}
		//cout << sum << ' ' << sub << endl;
		vector <ll> ans;
		ll tmp = (1ll << 60);
		if (sum & 1) tmp++;
		ans.pb(tmp);
		sub += ((sum + tmp) - (sum ^ tmp));
		sum ^= tmp;
		ll res = sum / 2 - sub / 2;
		ans.pb(res);
		ans.pb(res);
		cout << ans.size() << endl;
		for (int i = 0;i < ans.size();i++) {
			cout << ans[i] << ' ';
		}
		cout << endl;
	}
}


#include <iostream>
#include <sstream>
#include <iomanip>
#include <algorithm>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <vector>
#include <string>
#include <cstring>
#include <cmath>
#include <cstdio>
#define all(v) (v).begin(), (v).end()
#define pii pair<int, int>
#define pll pair<ll, ll>
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define test cerr << '!' << endl;
using namespace std;

typedef long long ll;
typedef unsigned long long ull;

int main0 ();
int main () {
	#ifndef ONLINE_JUDGE
		freopen("C:\\Users\\98497\\Desktop\\code\\file.in", "r", stdin);
	#endif
	ios::sync_with_stdio(false);
	// clock_t start,end;
	// start = clock();
	main0();
	// end = clock();
	// cout << (end - start) << endl;
	#ifndef ONLINE_JUDGE
		fclose(stdin);
	#endif
	return 0;
}

const int INF = 0x3f3f3f3f;
const int N = 1e6;
const int M = 1e5;
const int mod = 1e9 + 7;

int a[N];

int main0 () {
	int T;
	cin >> T;
	while (T--) {
		int n;
		cin >> n;
		ll sum = 0, xorsum = 0;
		for (int i = 1;i <= n;i++) {
			cin >> a[i];
			sum += a[i];
			xorsum ^= a[i];
		}

		ll tmp = (1ll << 50);
		sum += tmp;
		xorsum ^= tmp;
		if (sum & 1) xorsum ^= 1;
		ll res = 2 * xorsum - sum;
		cout << 3 << endl;
		if (sum & 1) 	cout << tmp << ' ' << res / 2 << ' ' << res / 2 + 1 << endl;
		else 			cout << tmp << ' ' << res / 2 << ' ' << res / 2 << endl;
	}
}


#include <iostream>
#include <sstream>
#include <iomanip>
#include <algorithm>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <vector>
#include <string>
#include <cstring>
#include <cmath>
#include <cstdio>
#define all(v) (v).begin(), (v).end()
#define pii pair<int, int>
#define pll pair<ll, ll>
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define test cerr << '!' << endl;
using namespace std;

typedef long long ll;
typedef unsigned long long ull;

int main0 ();
int main () {
	#ifndef ONLINE_JUDGE
		freopen("C:\\Users\\98497\\Desktop\\code\\file.in", "r", stdin);
	#endif
	ios::sync_with_stdio(false);
	// clock_t start,end;
	// start = clock();
	main0();
	// end = clock();
	// cout << (end - start) << endl;
	#ifndef ONLINE_JUDGE
		fclose(stdin);
	#endif
	return 0;
}

const int INF = 0x3f3f3f3f;
const int N = 1e6;
const int M = 1e5;
const int mod = 1e9 + 7;

int a[N];

int main0 () {
	int T;
	cin >> T;
	while (T--) {
		int n;
		cin >> n;
		ll sum = 0, xorsum = 0;
		for (int i = 1;i <= n;i++) {
			cin >> a[i];
			sum += a[i];
			xorsum ^= a[i];
		}

		ll tmp = (1ll << 55);
		if (sum & 1) tmp++;
		sum += tmp;
		xorsum ^= tmp;
		ll res = 2 * xorsum - sum;
		cout << 3 << endl;
		cout << tmp << ' ' << res / 2 << ' ' << res / 2 << endl;
	}
}


#include <iostream>
#include <sstream>
#include <iomanip>
#include <algorithm>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <vector>
#include <string>
#include <cstring>
#include <cmath>
#include <cstdio>
#define all(v) (v).begin(), (v).end()
#define pii pair<int, int>
#define pll pair<ll, ll>
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define test cerr << '!' << endl;
using namespace std;

typedef long long ll;
typedef unsigned long long ull;

int main0 ();
int main () {
	#ifndef ONLINE_JUDGE
		freopen("C:\\Users\\98497\\Desktop\\code\\file.in", "r", stdin);
	#endif
	ios::sync_with_stdio(false);
	// clock_t start,end;
	// start = clock();
	main0();
	// end = clock();
	// cout << (end - start) << endl;
	#ifndef ONLINE_JUDGE
		fclose(stdin);
	#endif
	return 0;
}

const int INF = 0x3f3f3f3f;
const int N = 1e6;
const int M = 1e5;
const int mod = 1e9 + 7;

int a[N];

int main0 () {
	int T;
	cin >> T;
	while (T--) {
		int n;
		cin >> n;
		ll sum = 0, sub = 0;
		for (int i = 1;i <= n;i++) {
			cin >> a[i];
			sub += ((sum + a[i]) - (sum ^ a[i]));
			sum ^= a[i];
		}

		vector <ll> ans;
		ll tmp = (1ll << 50);
		if (sum & 1) tmp++;
		ans.pb(tmp);
		sum ^= tmp;
		ll res = sum / 2 - sub;
		ans.pb(res);
		ans.pb(res);
		cout << ans.size() << endl;
		for (int i = 0;i < ans.size();i++) {
			cout << ans[i] << ' ';
		}
		cout << endl;
	}
}


#include <iostream>
#include <sstream>
#include <iomanip>
#include <algorithm>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <vector>
#include <string>
#include <cstring>
#include <cmath>
#include <cstdio>
#define all(v) (v).begin(), (v).end()
#define pii pair<int, int>
#define pll pair<ll, ll>
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define test cerr << '!' << endl;
using namespace std;

typedef long long ll;
typedef unsigned long long ull;

int main0 ();
int main () {
	#ifndef ONLINE_JUDGE
		freopen("C:\\Users\\98497\\Desktop\\code\\file.in", "r", stdin);
	#endif
	ios::sync_with_stdio(false);
	// clock_t start,end;
	// start = clock();
	main0();
	// end = clock();
	// cout << (end - start) << endl;
	#ifndef ONLINE_JUDGE
		fclose(stdin);
	#endif
	return 0;
}

const int INF = 0x3f3f3f3f;
const int N = 1e6;
const int M = 1e5;
const int mod = 1e9 + 7;

int a[N];

int main0 () {
	int T;
	cin >> T;
	while (T--) {
		int n;
		cin >> n;
		ll sum = 0, sub = 0;
		for (int i = 1;i <= n;i++) {
			cin >> a[i];
			sub += ((sum + a[i]) - (sum ^ a[i]));
			sum ^= a[i];
		}
		//cout << sum << ' ' << sub << endl;
		vector <ll> ans;
		ll tmp = (1ll << 50);
		if (sum & 1) tmp++;
		ans.pb(tmp);
		sum ^= tmp;
		ll res = sum / 2 - sub / 2;
		ans.pb(res);
		ans.pb(res);
		cout << ans.size() << endl;
		for (int i = 0;i < ans.size();i++) {
			cout << ans[i] << ' ';
		}
		cout << endl;
	}
}


#include <iostream>
#include <sstream>
#include <iomanip>
#include <algorithm>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <vector>
#include <string>
#include <cstring>
#include <cmath>
#include <cstdio>
#define all(v) (v).begin(), (v).end()
#define pii pair<int, int>
#define pll pair<ll, ll>
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define test cerr << '!' << endl;
using namespace std;

typedef long long ll;
typedef unsigned long long ull;

int main0 ();
int main () {
	#ifndef ONLINE_JUDGE
		freopen("C:\\Users\\98497\\Desktop\\code\\file.in", "r", stdin);
	#endif
	ios::sync_with_stdio(false);
	// clock_t start,end;
	// start = clock();
	main0();
	// end = clock();
	// cout << (end - start) << endl;
	#ifndef ONLINE_JUDGE
		fclose(stdin);
	#endif
	return 0;
}

const int INF = 0x3f3f3f3f;
const int N = 1e6;
const int M = 1e5;
const int mod = 1e9 + 7;

int a[N];

int main0 () {
	int T;
	cin >> T;
	while (T--) {
		int n;
		cin >> n;
		ll sum = 0, sub = 0;
		for (int i = 1;i <= n;i++) {
			cin >> a[i];
			sub += ((sum + a[i]) - (sum ^ a[i]));
			sum ^= a[i];
		}
		//cout << sum << ' ' << sub << endl;
		vector <ll> ans;
		ll tmp = (1ll << 60);
		if (sum & 1) tmp++;
		ans.pb(tmp);
		sub += ((sum + a[i]) - (sum ^ a[i]));
		sum ^= tmp;
		ll res = sum / 2 - sub / 2;
		ans.pb(res);
		ans.pb(res);
		cout << ans.size() << endl;
		for (int i = 0;i < ans.size();i++) {
			cout << ans[i] << ' ';
		}
		cout << endl;
	}
}


#include <iostream>
#include <sstream>
#include <iomanip>
#include <algorithm>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <vector>
#include <string>
#include <cstring>
#include <cmath>
#include <cstdio>
#define all(v) (v).begin(), (v).end()
#define pii pair<int, int>
#define pll pair<ll, ll>
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define test cerr << '!' << endl;
using namespace std;

typedef long long ll;
typedef unsigned long long ull;

int main0 ();
int main () {
	#ifndef ONLINE_JUDGE
		freopen("C:\\Users\\98497\\Desktop\\code\\file.in", "r", stdin);
	#endif
	ios::sync_with_stdio(false);
	// clock_t start,end;
	// start = clock();
	main0();
	// end = clock();
	// cout << (end - start) << endl;
	#ifndef ONLINE_JUDGE
		fclose(stdin);
	#endif
	return 0;
}

const int INF = 0x3f3f3f3f;
const int N = 1e6;
const int M = 1e5;
const int mod = 1e9 + 7;

int a[N];

int main0 () {
	int T;
	cin >> T;
	while (T--) {
		int n;
		cin >> n;
		ll sum = 0, xorsum = 0;
		for (int i = 1;i <= n;i++) {
			cin >> a[i];
			sum += a[i];
			xorsum ^= a[i];
		}

		ll tmp = (1ll << 60);
		sum += tmp;
		xorsum ^= tmp;
		if (sum & 1) xorsum ^= 1;
		ll res = 2 * xorsum - sum;
		cout << 3 << endl;
		if (sum & 1) 	cout << tmp << ' ' << res / 2 << ' ' << res / 2 + 1 << endl;
		else 			cout << tmp << ' ' << res / 2 << ' ' << res / 2 << endl;
	}
}


#include <bits/stdc++.h>
typedef long long ll;
const int maxn=2e5+1;
using namespace std;
ll sum,ans,res,a[maxn];
int main()
{
	int T,n;
	scanf("%d",&T);
	while(T--)
	{
		sum=res=ans=0;
		scanf("%d",&n);
		for(int i=1;i<=n;++i) scanf("%lld",&a[i]),sum+=a[i],ans^=a[i];
		if(ans*2==sum) {
			printf("0\n");
			printf("\n");
			continue;
		}
		a[n+1]=ans,a[n+2]=sum+ans;
		printf("%d\n",n+2);
		for(int i=1;i<=n+2;++i) printf("%lld ",a[i]);
		printf("\n");
	}
}


#include <bits/stdc++.h>
typedef long long ll;
const int maxn=2e5+1;
using namespace std;
ll sum,ans,res,a[maxn];
int main()
{
	int T,n;
	scanf("%d",&T);
	while(T--)
	{
		sum=res=ans=0;
		scanf("%d",&n);
		for(int i=1;i<=n;++i) scanf("%lld",&a[i]),sum+=a[i],ans^=a[i];
		if(ans*2==sum) {
			printf("0\n");
			printf("\n");
			continue;
		}
		a[n+1]=ans,a[n+2]=sum+ans;
		printf("%d\n",n+2);
		for(int i=1;i<=2;++i) printf("%lld ",a[n+i]);
		printf("\n");
	}
}


#include <bits/stdc++.h>
typedef long long ll;
const int maxn=2e5+1;
using namespace std;
ll sum,ans,res,a[maxn];
int main()
{
	int T,n;
	scanf("%d",&T);
	while(T--)
	{
		sum=res=ans=0;
		scanf("%d",&n);
		for(int i=1;i<=n;++i) scanf("%lld",&a[i]),sum+=a[i],ans^=a[i];
		a[n+1]=ans,a[n+2]=sum+ans;
		printf("%d\n",n+2);
		for(int i=1;i<=n+2;++i) printf("%lld ",a[i]);
		printf("\n");
	}
}


#include <bits/stdc++.h>
typedef long long ll;
const int maxn=2e5+1;
using namespace std;
ll sum,ans,res,a[maxn];
int main()
{
	int T,n;
	scanf("%d",&T);
	while(T--)
	{
		sum=res=ans=0;
		scanf("%d",&n);
		for(int i=1;i<=n;++i) scanf("%lld",&a[i]),sum+=a[i],ans^=a[i];
		if(ans*2==sum) {
			printf("0\n");
			printf("\n");
			continue;
		}
		a[n+1]=ans,a[n+2]=sum+ans;
		printf("2\n");
//		for(int i=1;i<=n+2;++i) res^=a[i];
//		printf("ss%lld\n",res);
		for(int i=1;i<=2;++i) printf("%lld ",a[n+i]);
		printf("\n");
	}
}


#include <bits/stdc++.h>
using namespace std;
int main()
{
	int t;
	scanf("%d",&t);
	while(t--)
	{
		long long xorsum=0,addsum=0,n;
		scanf("%I64d",&n);
		for(long long i=1;i<=n;i++)
		{
			long long k;
			scanf("%I64d",&k);
			xorsum^=k;
			addsum+=k;
		}
		addsum+=xorsum;
		printf("2\n");
		printf("%I64d %I64d\n",xorsum,addsum);
	}
	return 0;
}


#include<iostream>
#include<algorithm>

using namespace std;

int XOR = NULL, SUM = NULL;

int main()
{
	int T;
	cin >> T;
	while (T--)
	{
		int n;
		cin >> n;
		for (int i = 1; i <= n; i++)
		{
			int x;
			cin >> x;
			XOR ^= x;
			SUM += x;
		}
		cout << 2 << endl << XOR << " " << SUM << endl;
	}
}


#include<iostream>
using namespace std;
int main()
{
	int n;
	long long int sum1,sum2;
	long long int s;
	cin>>n;
	for(int i=0;i<n;i++)
	{
		int a=0,b=0;
		int m;
		cin>>m;
		sum1=0,sum2=0;
		for(int j=0;j<m;j++)
		{
		    cin>>s;
			sum1+= s;
			sum2 = sum2^s;
		}
		if(sum1==2*sum2)
		{
			cout<<"0"<<endl;
			cout<<endl;
		}
		else
		{
			a=sum1+sum2;
			b=sum2;
			cout<<"2"<<endl;
			cout<<b<<" "<<a<<endl;
		}
	}
	return 0;
}


#include <bits/stdc++.h>
#pragma GCC optimize("O2")
#define LL long long
using namespace std;
const int INF=0x3f3f3f3f,N=5e6+5,MOD=1e9+7;
inline int getplc(int x,int y) { return (x>>y)&1; }
LL qpow(LL a,LL b=MOD-2,LL _MOD=MOD){
  LL res=1;
  for(;b;b>>=1,a=a*a%_MOD){
    if(b&1)res=res*a%_MOD;
  }
  return res;
}

void Solve()
{
  int cas;
  cin>>cas;
  while(cas--){
    int n;
    LL a=0,b=0;
    cin>>n;
    for(int i=1;i<=n;i++)
    {
      int x;
      cin>>x;
      b^=x;
      a+=x;
    }
    cout<<2<<'\n';
    cout<<b<<" "<<a+b<<'\n';
  }
}

int main() {
#ifndef ONLINE_JUDGE
   freopen("in.txt","r",stdin);
//  freopen("o1.txt","w",stdout);
#endif
  ios::sync_with_stdio(false);cin.tie(0),cout.tie(0);
  Solve();
  return 0;
}


/**
 *　　　　　　　　 ┏┓  　　  ┏┓
 * 　　　　　　　┏┛┗━━━━┛┗┓
 * 　　　　　　　┃　　　　　　　   ┃
 * 　　　　　　　┃　　　━　　 　  ┃
 * 　　　　　　　┃　＞　　　＜　   ┃
 * 　　　　　　　┃　　　　　　　   ┃
 * 　　　　　　　┃...　⌒　...    ┃
 * 　　　　　　　┃　　　　　　　   ┃
 * 　　　　　　　┗━┓　　　┏━━┛
 * 　　　　　　　　　┃　　　┃　Code is far away from bug with the animal protecting
 * 　　　　　　　　　┃　　　┃   神兽保佑,代码无bug
 * 　　　　　　　　　┃　　　┃
 * 　　　　　　　　　┃　　　┃
 * 　　　　　　　　　┃　　　┃
 * 　　　　　　　　　┃　　　┃
 * 　　　　　　　　　┃　　　┗━━━┓
 * 　　　　　　　　　┃　　　　　　　┣┓
 * 　　　　　　　　　┃　　　　　　　┏┛
 * 　　　　　　　　　┗┓┓┏━┳┓┏┛
 * 　　　　　　　　　　┃┫┫　┃┫┫
 * 　　　　　　　　　　┗┻┛　┗┻┛
 */
// warm heart, wagging tail,and a smile just for you!
//
//                            _ooOoo_
//                           o8888888o
//                           88" . "88
//                           (| -_- |)
//                           O\  =  /O
//                        ____/`---'\____
//                      .'  \|     |//  `.
//                     /  \|||  :  |||//  \
//                    /  _||||| -:- |||||-  \
//                    |   | \  -  /// |   |
//                    | \_|  ''\---/''  |   |
//                    \  .-\__  `-`  ___/-. /
//                  ___`. .'  /--.--\  `. . __
//               ."" '<  `.___\_<|>_/___.'  >'"".
//              | | :  `- \`.;`\ _ /`;.`/ - ` : | |
//              \  \ `-.   \_ __\ /__ _/   .-` /  /
//         ======`-.____`-.___\_____/___.-`____.-'======
//                            `=---='
//        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
//                     佛祖保佑      永无BUG
#include <set>
#include <map>
#include <stack>
#include <cmath>
#include <queue>
#include <cstdio>
#include <string>
#include <bitset>
#include <vector>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;
inline int read(){
   int s=0,w=1;
   char ch=getchar();
   while(ch<'0'||ch>'9'){ if(ch=='-')w=-1;ch=getchar();}
   while(ch>='0'&&ch<='9') s=s*10+ch-'0',ch=getchar();
   return s*w;
}
include<bits/stdc++.h>
using namespace std;
#define rep(i,a,n) for(int i=a;i<=n;i++)
typedef long long ll;
const int INF=0x3f3f3f3f;
const int MAXN=2*1e5+5;
int s[MAXN];
int main(){
    int t=read();
    while(t--){
        int n=read();
        int sum=0,xorr=0;
        for(int i=1;i<=n;i++){
            s[i]=read();
            sum+=s[i];
            xorr^=s[i];
        }
        cout<<2<<endl<<xorr<<" "<<sum<<endl;
    }
    return 0;
}


#include <cstdio>
#include <cstring>
#include <cmath>
#include <iostream>
#include <algorithm>
#include <queue>
#include <set>
#include <vector>
#include <stack>
#include <map>
#define ri register
#define inf 0x7fffffff
#define E (1)
#define mk make_pair
#define int long long
using namespace std;
inline int read()
{
	int s=0, w=1; ri char ch=getchar();
	while(ch<'0'||ch>'9') {if(ch=='-') w=-1; ch=getchar(); }
	while(ch>='0'&&ch<='9') s=(s<<3)+(s<<1)+(ch^48), ch=getchar(); return s*w;
}
void print(int x) {if(x<0) x=-x, putchar('-'); if(x>9) print(x/10); putchar(x%10+'0'); }
signed main()
{
	for(ri int T=read();T;T--)
	{
		int n=read();
		int p,q; p=q=0;
		for(ri int i=1;i<=n;i++)
		{
			int x=read();
			p^=x, q+=x;
		}
		printf("2\n%lld %lld\n",p,p+q);
	}
	return 0;
}


#include<bits/stdc++.h>
#define int long long
using namespace std;
int read(){
	int f=1,re=0;
	char ch;
	for(ch=getchar();!isdigit(ch)&&ch!='-';ch=getchar());
	if(ch=='-'){f=-1;ch=getchar();}
	for(;isdigit(ch);ch=getchar()) re=(re<<3)+(re<<1)+ch-'0';
	return re*f;
}
signed main(){
	int t=read();
	while(t--){
		int n=read(),sum1=0,sum2=0;
		for(int i=1;i<=n;i++){
			int x=read();
			sum1+=x;
			sum2^=x;
		}printf("2\n");
		printf("%lld %lld\n",sum2,sum1+sum2);
	}return 0;
}


#include<iostream>
#include<algorithm>

using namespace std;

long long XOR = NULL, SUM = NULL;

int main()
{
	int T;
	cin >> T;
	while (T--)
	{
		int n;
		cin >> n;
		for (int i = 1; i <= n; i++)
		{
			int x;
			cin >> x;
			XOR ^= x;
			SUM += x;
		}
		cout << 2 << endl << XOR << " " << SUM + XOR << endl;
	}
}


#include<cstdio>
using namespace std;
long long t,flag,a,n,xr,sum;
int main(){
	scanf("%lld",&t);
	while(t--){
		sum=xr=0;
		scanf("%lld",&n);
		while(n--){
			scanf("%lld",&a);
			sum+=a;
			xr^=a;
		}
		printf("2\n%lld %lld\n",xr,xr+sum);
	}
}


#include <cstdio>
int t,n;
long long x,y,z;
int main()
{
	scanf("%d",&t);
	while(t--)
	{
		scanf("%d",&n),x=y=0;
		for(int i=1;i<=n;i++)
			scanf("%lld",&z),x+=z,y|=z;
		printf("2\n");
			printf("%lld %lld\n",y,x+y);
	}
}


#include <bits/stdc++.h>
using namespace std;

#define FOR(i, a, b) for (int i = a; i <= b; i++)
#define ROF(i, a, b) for (int i = a; i >= b; i--)
#define Debug(x) cerr << #x << ": " << x << endl
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define fst first
#define snd second
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

typedef long long LL;
typedef long double LD;
typedef unsigned int UI;
typedef unsigned long long ULL;
typedef pair<int, int> PII;
typedef pair<int, LL> PIL;
typedef pair<LL, int> PLI;
typedef pair<LL, LL> PLL;
typedef vector<int> VI;
typedef vector<LL> VL;

const LL Mod = 998244353;
const LL INF = (1LL << 60);

namespace IO {

	template<typename T> inline void read(T &x) {
		char c = getchar(); int f = 1; x = 0;
		for (; !isdigit(c); c = getchar()) if (c == '-') f = -1;
		for (; isdigit(c); c = getchar()) x = x * 10 + c - '0';
		x *= f;
	}
	template<typename T> inline void write(T x) {
		if (x < 0) putchar('-'), x = -x;
		if (x > 9) write(x / 10); putchar(x % 10 + '0');
	}
	template<typename T> inline void chkmin(T &x, T y) { x = x < y ? x : y; }
	template<typename T> inline void chkmax(T &x, T y) { x = x > y ? x : y; }

}

namespace CALC {

	template<typename T> inline void Add(T &x, T y) { x = (x + y) % Mod; }
	template<typename T> inline void Sub(T &x, T y) { x = ((x - y) % Mod + Mod) % Mod; }
	template<typename T> inline T pls(T x, T y) { return (x + y) % Mod; }
	template<typename T> inline T slp(T x, T y) { return ((x - y) % Mod + Mod) % Mod; }
	inline LL qpow(LL x, LL y) {
		LL ret = 1; for (; y; y >>= 1, x = x * x % Mod) if (y & 1) ret = ret * x % Mod; return ret;
	}

}

using namespace IO;
using namespace CALC;

int main() {
	int T; read(T);
	LL Lim = 1; FOR(i, 1, 55) Lim *= 2LL; Lim--;
	while (T--) {
		LL A = 0, S = 0, x, y, z; int N;
		read(N);
		FOR(i, 1, N) { LL t; read(t); A ^= t; S += t; }
		x = Lim ^ A;
		if (S & 1) { x |= 1; assert(x != -INF); }
		else { x ^= (x & 1); assert(x != -INF); }
		int ans = 3; LL tmp = (S + x) >> 1;
		y = (A ^ x) - tmp; z = y;
		printf("%d\n%lld %lld %lld\n", ans, x, y, z);
	}
	return 0;
}


#include<bits/stdc++.h>
#define FL fflush(stdout)
template<class T> inline void read(T &x){
	x=0;register char c=getchar();register bool f=0;
	while(!isdigit(c))f^=c=='-',c=getchar();
	while(isdigit(c))x=x*10+c-'0',c=getchar();if(f)x=-x;
}
template<class T> inline void print(T x){
	if(x<0)putchar('-'),x=-x;
	if(x>9)print(x/10);putchar(x%10+'0');
}
template<class T> inline void print(T x,char c){print(x),putchar(c);}
template<class T> inline void print(T a,int l,int r){for(int i=l;i<=r;i++)print(a[i]," \n"[i==r]);}
const int N=2e5+10;
int T,n,a[N],min,pos;
int main(){
#ifdef memset0
	freopen("1.in","r",stdin);
#endif
	for(read(T);T--;){
		min=INT_MAX,read(n);
		for(int i=1;i<=n;i++)read(a[i]);
		for(int i=1;i<=n;i++){
			if(a[i]-i>=min){
				printf("Yes\n%d %d\n",pos,i);
				goto finish;
			}
			if (min>a[i]-i+1)min=a[i]-i+1,pos=i;
		}
		min=INT_MAX,std::reverse(a+1,a+1+n);
		for(int i=1;i<=n;i++){
			if(a[i]-i>=min){
				printf("Yes\n%d %d\n",n+1-i,n+1-pos);
				goto finish;
			}
			if(min>a[i]-i+1)min=a[i]-i+1,pos=i;
		}
		puts("No");
		finish:;
	}
}


#include<bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long

signed main(){
    int t;
    cin>>t;
    while(t--){
        int n;
        cin>>n;
        vector<int> v(n);
        for(int i=0;i<n;i++) cin>>v[i];
        int X=v[0],S=v[0];
        for(int i=1;i<n;i++) X^=v[i],S+=v[i];
        int elem=(1LL<<50)+S%2;
        S+=elem;
        X^=elem;
        int ans=2*X-S;
        cout<<3<<"\n"<<elem<<" "<<ans/2<<" "<<ans/2<<" "<<endl;
    }
}


#include<bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long

signed main(){
    int t;
    cin>>t;
    while(t--){
        int n;
        cin>>n;
        vector<int> v(n);
        for(int i=0;i<n;i++) cin>>v[i];
        int X=v[0],S=v[0];
        for(int i=1;i<n;i++) X^=v[i],S+=v[i];
        if(S==2*X) continue;
        int elem=(1ll<<50)+S%2;
        S+=elem;
        X^=elem;
        int ans=2*X-S;
        cout<<elem<<" "<<ans/2<<" "<<ans/2<<" "<<endl;
    }
}


#include<bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long

signed main(){
    int t;
    cin>>t;
    while(t--){
        int n;
        cin>>n;
        vector<int> v(n);
        for(int i=0;i<n;i++) cin>>v[i];
        int X=v[0],S=v[0];
        for(int i=1;i<n;i++) X^=v[i],S+=v[i];
        if(S==2*X){
            cout<<"\n";
            continue;
        }
        int elem=(1ll<<30)+S%2;
        S+=elem;
        X^=elem;
        int ans=2*X-S;
        cout<<elem<<" "<<ans/2<<" "<<ans/2<<" "<<endl;
    }
}


#include<bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long

signed main(){
    int t;
    cin>>t;
    while(t--){
        int n;
        cin>>n;
        vector<int> v(n);
        for(int i=0;i<n;i++) cin>>v[i];
        int X=v[0],S=v[0];
        for(int i=1;i<n;i++) X^=v[i],S+=v[i];
        /*int elem=(1LL<<50)+S%2;
        S+=elem;
        X^=elem;
        int ans=2*X-S;
        cout<<3<<"\n"<<elem<<" "<<ans/2<<" "<<ans/2<<" "<<endl;*/
        cout<<2<<"\n"<<X<<" "<<S+X<<"\n";
    }
}


#include<bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long

signed main(){
    int t;
    cin>>t;
    while(t--){
        int n;
        cin>>n;
        vector<int> v(n);
        for(int i=0;i<n;i++) cin>>v[i];
        int X=v[0],S=v[0];
        for(int i=1;i<n;i++) X^=v[i],S+=v[i];
        if(S==2*X) continue;
        int elem=(1ll<<30)+S%2;
        S+=elem;
        X^=elem;
        int ans=2*X-S;
        cout<<elem<<" "<<ans/2<<" "<<ans/2<<" "<<endl;
    }
}


#include<bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long

signed main(){
    int t;
    cin>>t;
    while(t--){
        int n;
        cin>>n;
        vector<int> v(n);
        for(int i=0;i<n;i++) cin>>v[i];
        int X=v[0],S=v[0];
        for(int i=1;i<n;i++) X^=v[i],S+=v[i];
        if(S==2*X) continue;
        int elem=(1ll<<31)+S%2;
        S+=elem;
        X^=elem;
        int ans=2*X-S;
        cout<<elem<<" "<<ans/2<<" "<<ans/2<<" "<<endl;
    }
}


// x,y x+y y -> x+y+x+y x+y -> x+y = 2*(x+y)
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int t,n,a,x=0,y=0;
    cin>>t;
    while(t--) {
        cin >> n;
        for (int i = 0; i < n; i++) cin >> a, x += a, y ^= a;
        cout<<"2"<<endl<<y<<" "<<x+y<<endl;
    }
    return 0;
}


// x,y x+y y -> x+y+x+y x+y -> x+y = 2*(x+y)
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int t,n;
    cin>>t;
    while(t--) {
        cin >> n;
        long long x=0,y=0,a;
        for (int i = 0; i < n; i++) cin >> a, x += a, y ^= a;
        if(x==(y<<1))cout<<0<<endl<<endl;
        else cout<<2<<endl<<y<<" "<<x+y<<endl;
    }
    return 0;
}


// x,y x+y y -> x+y+x+y x+y -> x+y = 2*(x+y)
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int t,n,a;
    long long x=0,y=0;
    cin>>t;
    while(t--) {
        cin >> n;
        for (int i = 0; i < n; i++) cin >> a, x += a, y ^= a;
        if(x==(y<<1))cout<<"0"<<endl<<endl;
        else cout<<"2"<<endl<<y<<" "<<x+y<<endl;
    }
    return 0;
}


// x,y x+y y -> x+y+x+y x+y -> x+y = 2*(x+y)
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int t,n,a;
    long long x=0,y=0;
    cin>>t;
    while(t--) {
        cin >> n;
        for (int i = 0; i < n; i++) cin >> a, x += a, y ^= a;
        cout<<"2"<<endl<<y<<" "<<x+y<<endl;
    }
    return 0;
}


// x,y x+y y -> x+y+x+y x+y -> x+y = 2*(x+y)
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int t,n;
    long long x=0,y=0,a;
    cin>>t;
    while(t--) {
        cin >> n;
        for (int i = 0; i < n; i++) cin >> a, x += a, y ^= a;
        if(x==(y<<1))cout<<0<<endl<<endl;
        else cout<<2<<endl<<y<<" "<<x+y<<endl;
    }
    return 0;
}


#include <bits/stdc++.h>
#define foi(i,k,n) for(int i = (int)k; i < (int)n; ++i)
using namespace std;
using ll = long long;
using ii = pair<int,int>;
constexpr int MAXN = 5 + 100000;
int arr[MAXN];

vector<ll> v;

void solve(ll s, ll x) {
  ll dif = s - 2LL*x;

  if (dif == 0) {
    return;
  }

  if (dif > 0) {
    v.push_back(dif);
    return;
  } else {
    dif = -dif;
    if (dif & 1LL) {
      v.push_back(1);
      solve(s + 1LL, x ^ 1LL);
      return;
    } else {
      v.push_back(dif >> 1);
      v.push_back(dif >> 1);
      return;
    }
  }
}

int main() {
  ios::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
  int tc; cin >> tc;
  while (tc--) {
    int n; cin >> n;
    ll s = 0, x = 0;
    foi (i,0,n) {
      cin >> arr[i];
      s += arr[i];
      x ^= arr[i];
    }
    v.clear();
    solve(s,x);
    assert(v.size() <= 3);
    cout << v.size() << '\n';
    for (ll p : v) {
      cout << p << ' ';
    }
    cout << '\n';
  }
  return 0;
}


#include <bits/stdc++.h>
#define foi(i,k,n) for(int i = (int)k; i < (int)n; ++i)
using namespace std;
using ll = long long;
using ii = pair<int,int>;
constexpr int MAXN = 5 + 100000;
ll arr[MAXN];

vector<ll> v;

void solve(ll s, ll x) {
  ll dif = s - 2LL*x;

  if (dif == 0) {
    return;
  }

  if (dif > 0) {
    ll add = 1LL << 50;
    if (dif & 1) {
      add ^= 1;
    }
    s += add;
    x ^= add;
    v.push_back(add);
    assert(2LL*x > s);
    solve(s, x);
    return;
  } else {
    dif = -dif;
    if (dif & 1LL) {
      v.push_back(1);
      solve(s + 1LL, x ^ 1LL);
      return;
    } else {
      v.push_back(dif >> 1);
      v.push_back(dif >> 1);
      return;
    }
  }
}

int main() {
  ios::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
  int tc; cin >> tc;
  while (tc--) {
    int n; cin >> n;
    ll s = 0, x = 0;
    foi (i,0,n) {
      cin >> arr[i];
      s += arr[i];
      x ^= arr[i];
    }
    v.clear();
    solve(s,x);
    // assert(v.size() <= 3);

    for (ll p : v) {
      s += p;
      x ^= p;
    }
    assert(s == 2*x);

    cout << v.size() << '\n';
    for (ll p : v) {
      cout << p << ' ';
    }
    cout << '\n';
  }
  return 0;
}


#include <bits/stdc++.h>
#define foi(i,k,n) for(int i = (int)k; i < (int)n; ++i)
using namespace std;
using ll = long long;
using ii = pair<int,int>;
constexpr int MAXN = 5 + 100000;
ll arr[MAXN];

vector<ll> v;

void solve(ll s, ll x) {
  ll dif = s - 2LL*x;

  if (dif == 0) {
    return;
  }

  if (dif > 0) {
    ll add = 1LL << 50;
    if (dif & 1) {
      add ^= 1;
    }
    s += add;
    x ^= add;
    v.push_back(add);
    assert(2LL*x > s);
    solve(s, x);
    return;
  } else {
    dif = -dif;
    if (dif & 1LL) {
      v.push_back(1);
      solve(s + 1LL, x ^ 1LL);
      return;
    } else {
      v.push_back(dif >> 1);
      v.push_back(dif >> 1);
      return;
    }
  }
}

int main() {
  ios::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
  int tc; cin >> tc;
  while (tc--) {
    int n; cin >> n;
    ll s = 0, x = 0;
    foi (i,0,n) {
      cin >> arr[i];
      s += arr[i];
      x ^= arr[i];
    }
    v.clear();
    solve(s,x);
    assert(v.size() <= 3);

    for (ll p : v) {
      s += p;
      x ^= p;
    }
    assert(s == 2*x);

    cout << v.size() << '\n';
    for (ll p : v) {
      cout << p << ' ';
    }
    cout << '\n';
  }
  return 0;
}


#include <bits/stdc++.h>
#define foi(i,k,n) for(int i = (int)k; i < (int)n; ++i)
using namespace std;
using ll = long long;
using ii = pair<int,int>;
constexpr int MAXN = 5 + 100000;
ll arr[MAXN];

vector<ll> v;

void solve(ll s, ll x) {
  ll dif = s - 2LL*x;

  if (dif == 0) {
    return;
  }

  if (dif > 0) {
    ll add = 1LL << 50;
    if (dif & 1) {
      add ^= 1;
    }
    s += add;
    x ^= add;
    v.push_back(add);
    assert(2LL*x > s);
    assert((2LL*x - s) % 2 == 0);
    solve(s, x);
    return;
  } else {
    dif = -dif;
    if (dif & 1LL) {
      ll add = (1LL << 50) ^ 1;
      v.push_back(add);
      solve(s + add, x ^ add);
      return;
    } else {
      v.push_back(dif >> 1);
      v.push_back(dif >> 1);
      return;
    }
  }
}

int main() {
  ios::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
  int tc; cin >> tc;
  while (tc--) {
    int n; cin >> n;
    ll s = 0, x = 0;
    foi (i,0,n) {
      cin >> arr[i];
      s += arr[i];
      x ^= arr[i];
    }
    v.clear();
    solve(s,x);
    assert(v.size() <= 3);

    for (ll p : v) {
      s += p;
      x ^= p;
    }
    assert(s == 2LL*x);

    cout << v.size() << '\n';
    for (ll p : v) {
      cout << p << ' ';
    }
    cout << '\n';
  }
  return 0;
}


/// awoooooo

# include <bits/stdc++.h>
# define sz(x) (int)((x).size())

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair < int, int > pii;

const int N = (int)2e5 + 5;
const int inf = (int)1e9 + 7;

int t;
int n;

void solve(){
  scanf("%d", &n);
  ll cursum = 0;
  ll curxor = 0;
  for(int i = 1; i <= n; ++i){
    int x;
    scanf("%d", &x);
    cursum += x;
    curxor ^= x;
  }
  printf("2\n");
  printf("%lld ", (1LL << 50) - cursum);
  curxor ^= ((1LL << 50) - cursum);
  cursum = (1LL << 50);
  ll num = 0;
  for(int i = 1; i <= 50; ++i){
    if(((cursum >> i) & 1LL) != ((curxor >> (i - 1LL)) & 1LL)){
      num |= (1LL << i);
      cursum += (1LL << i);
      curxor ^= (1LL << i);
    }
  }
  printf("%lld\n", num);
}

int main(){
  scanf("%d", &t);
  while(t--){
    solve();
  }
  return 0;
}


/// awoooooo

# include <bits/stdc++.h>
# define sz(x) (int)((x).size())

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair < int, int > pii;

const int N = (int)2e5 + 5;
const int inf = (int)1e9 + 7;

int t;
int n;

void solve(){
  scanf("%d", &n);
  ll cursum = 0;
  ll curxor = 0;
  for(int i = 1; i <= n; ++i){
    int x;
    scanf("%d", &x);
    cursum += x;
    curxor ^= x;
  }
  printf("2\n");
  printf("%lld ", (1LL << 50) - cursum);
  curxor ^= ((1LL << 50) - cursum);
  cursum = (1LL << 50);
  ll num = 0;
  for(int i = 1; cursum != curxor * 2; ++i){
    if(((cursum >> i) & 1LL) != ((curxor >> (i - 1LL)) & 1LL)){
      num |= (1LL << i);
      cursum += (1LL << i);
      curxor ^= (1LL << i);
    }
  }
  printf("%lld\n", num);
}

int main(){
  scanf("%d", &t);
  while(t--){
    solve();
  }
  return 0;
}


/// awoooooo

# include <bits/stdc++.h>
# define sz(x) (int)((x).size())

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair < int, int > pii;

const int N = (int)2e5 + 5;
const int inf = (int)1e9 + 7;

int t;
int n;

void solve(){
  scanf("%d", &n);
  ll cursum = 0;
  ll curxor = 0;
  for(int i = 1; i <= n; ++i){
    int x;
    scanf("%d", &x);
    cursum += x;
    curxor ^= x;
  }
  ll num = 0;
  if(cursum % 2){
    curxor ^= 1;
    cursum++;
    num = 1;
  }
  for(int i = 1; cursum != curxor * 2; ++i){
    if(((cursum >> i) & 1LL) != ((curxor >> (i - 1LL)) & 1LL)){
      num |= (1LL << i);
      cursum += (1LL << i);
      curxor ^= (1LL << i);
    }
  }
  printf("%lld\n", num);
}

int main(){
  scanf("%d", &t);
  while(t--){
    solve();
  }
  return 0;
}


# include <bits/stdc++.h>
# define sz(x) (int)((x).size())

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair < int, int > pii;

const int N = (int)2e5 + 5;
const int inf = (int)1e9 + 7;

int t;
int n;

void solve(){
  scanf("%d", &n);
  ll cursum = 0;
  ll curxor = 0;
  for(int i = 1; i <= n; ++i){
    int x;
    scanf("%d", &x);
    cursum += x;
    curxor ^= x;
  }
  ll num = 0;
  if(cursum % 2){
    curxor ^= 1;
    cursum++;
    num = 1;
  }
  for(int i = 1; cursum != curxor * 2; ++i){
    if(((cursum >> i) & 1LL) != ((curxor >> (i - 1LL)) & 1LL)){
      num |= (1LL << i);
      cursum += (1LL << i);
      curxor ^= (1LL << i);
    }
  }
  printf("1\n%lld\n", num);
}

int main(){
  scanf("%d", &t);
  while(t--){
    solve();
  }
  return 0;
}


/// awoooooo

# include <bits/stdc++.h>
# define sz(x) (int)((x).size())

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair < int, int > pii;

const int N = (int)2e5 + 5;
const int inf = (int)1e9 + 7;

int t;
int n;

void solve(){
  scanf("%d", &n);
  ll cursum = 0;
  ll curxor = 0;
  for(int i = 1; i <= n; ++i){
    int x;
    scanf("%d", &x);
    cursum += x;
    curxor ^= x;
  }
  printf("2\n");
  printf("%lld ", (1LL << 50) - cursum);
  curxor ^= ((1LL << 50) - cursum);
  cursum = (1LL << 50);
  ll num = 0;
  for(int i = 1; i <= 50; ++i){
    if(((cursum >> i) & 1ll) != ((curxor >> (i - 1ll)) & 1ll)){
      num |= (1ll << i);
      cursum += (1ll << i);
    }
  }
  printf("%lld\n", num);
}

int main(){
  scanf("%d", &t);
  while(t--){
    solve();
  }
  return 0;
}


#include <iostream>
#define endl '\n'
#define NMax 100000
using namespace std;

long long t;
long long arr[NMax + 2];

long long toint(string s)
{
    long long res = 0LL;
    for(long long i = 0; i < s.size(); i ++)
        res = res * 2 + (s[i] - '0');
    return res;
}

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    cin >> t;

    for(long long x = 0; x < t; x ++)
    {
        long long n, res1 = 0LL, res2 = 0LL;
        cin >> n;
        for(long long i = 0; i < n; i ++)
        {
            cin >> arr[i];
            if(i == 0)
                res1 = arr[i];
            else
                res1 ^= arr[i];
            res2 += arr[i];
        }
        long long naum = 0;

        string a1 = "", a2 = "", a3 = "";
        res1 <<= 1;
        while(res1 || res2)
        {
            if(((res2 + naum) & 1) == (res1 & 1))
            {
                a1 = "0" + a1;
                a2 = "0" + a2;
                a3 = "0" + a3;
                res2 >>= 1;
                res1 >>= 1;
            }
            else
            {
                naum = 0;
                a1 = "1" + a1;
                a2 = "0" + a2;
                a3 = "0" + a3;
                res2 >>= 1;
                res1 >>= 1;
            }
        }
        cout << toint(a1) << " " << toint(a2) << " " << toint(a3) << endl;

    }

    return 0;
}
/**
1
5 3
3 1 5 4 2
5 3 2
*/


#include <iostream>
#define endl '\n'
#define NMax 100000
using namespace std;

long long t;
long long arr[NMax + 2];

long long toint(string s)
{
    long long res = 0LL;
    for(long long i = 0; i < s.size(); i ++)
        res = res * 2 + (s[i] - '0');
    return res;
}

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    cin >> t;

    for(long long x = 0; x < t; x ++)
    {
        long long n, res1 = 0LL, res2 = 0LL;
        cin >> n;
        for(long long i = 0; i < n; i ++)
        {
            cin >> arr[i];
            if(i == 0)
                res1 = arr[i];
            else
                res1 ^= arr[i];
            res2 += arr[i];
        }
        long long naum = 0;

        string a1 = "", a2 = "", a3 = "";
        res1 <<= 1;
        cout << 3 << endl;
        while(res1 || res2)
        {
            if(((res2 + naum) & 1) == ((res1 + a1[0]) & 1))
            {
                naum = ((res2 & 1) + naum) / 2;
                a1 = "0" + a1;
                a2 = "0" + a2;
                a3 = "0" + a3;
                res2 >>= 1;
                res1 >>= 1;
            }
            else
            {
                naum = ((res2 & 1) + naum + 1) / 2;
                a1 = "1" + a1;
                a2 = "0" + a2;
                a3 = "0" + a3;
                res2 >>= 1;
                res1 >>= 1;
            }
        }
        if(naum == 1 && a1[0] == '0') a1 = "1" + a1;
        cout << toint(a1) << " " << toint(a2) << " " << toint(a3) << endl;

    }

    return 0;
}
/**
1
5 3
3 1 5 4 2
5 3 2
*/


#include <iostream>
#define endl '\n'
#define NMax 100000
using namespace std;

long long t;
long long arr[NMax + 2];

long long toint(string s)
{
    long long res = 0LL;
    for(long long i = 0; i < s.size(); i ++)
        res = res * 2 + (s[i] - '0');
    return res;
}

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    cin >> t;

    for(long long x = 0; x < t; x ++)
    {
        long long n, res1 = 0LL, res2 = 0LL;
        cin >> n;
        for(long long i = 0; i < n; i ++)
        {
            cin >> arr[i];
            if(i == 0)
                res1 = arr[i];
            else
                res1 ^= arr[i];
            res2 += arr[i];
        }
        long long naum = 0;

        string a1 = "", a2 = "", a3 = "";
        res1 <<= 1;
        cout << 3 << endl;
        while(res1 || res2)
        {
            if(((res2 + naum) & 1) == (res1 & 1))
            {
                naum = ((res2 & 1) + naum) / 2;
                a1 = "0" + a1;
                a2 = "0" + a2;
                a3 = "0" + a3;
                res2 >>= 1;
                res1 >>= 1;
            }
            else
            {
                naum = ((res2 & 1) + naum + 1) / 2;
                a1 = "1" + a1;
                a2 = "0" + a2;
                a3 = "0" + a3;
                res2 >>= 1;
                res1 >>= 1;
            }
        }
        if(naum) a1 = "1" + a1;
        cout << toint(a1) << " " << toint(a2) << " " << toint(a3) << endl;

    }

    return 0;
}
/**
1
5 3
3 1 5 4 2
5 3 2
*/


#include <iostream>
#define endl '\n'
#define NMax 100000
using namespace std;

long long t;
long long arr[NMax + 2];

long long toint(string s)
{
    long long res = 0LL;
    for(long long i = 0; i < s.size(); i ++)
        res = res * 2 + (s[i] - '0');
    return res;
}

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    cin >> t;

    for(long long x = 0; x < t; x ++)
    {
        long long n, res1 = 0LL, res2 = 0LL;
        cin >> n;
        for(long long i = 0; i < n; i ++)
        {
            cin >> arr[i];
            if(i == 0)
                res1 = arr[i];
            else
                res1 ^= arr[i];
            res2 += arr[i];
        }
        long long naum = 0;

        string a1 = "", a2 = "", a3 = "";
        res1 <<= 1;
        cout << 3 << endl;
        while(res1 || res2)
        {
            if(((res2 + naum) & 1) == (res1 & 1))
            {
                a1 = "0" + a1;
                a2 = "0" + a2;
                a3 = "0" + a3;
                res2 >>= 1;
                res1 >>= 1;
            }
            else
            {
                naum = 0;
                a1 = "1" + a1;
                a2 = "0" + a2;
                a3 = "0" + a3;
                res2 >>= 1;
                res1 >>= 1;
            }
        }
        cout << toint(a1) << " " << toint(a2) << " " << toint(a3) << endl;

    }

    return 0;
}
/**
1
5 3
3 1 5 4 2
5 3 2
*/


#include <iostream>
#define endl '\n'
#define NMax 100000
using namespace std;

long long t;
long long arr[NMax + 2];

long long toint(string s)
{
    long long res = 0LL;
    for(long long i = 0; i < s.size(); i ++)
        res = res * 2 + (s[i] - '0');
    return res;
}

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    cin >> t;

    for(long long x = 0; x < t; x ++)
    {
        long long n, res1 = 0LL, res2 = 0LL;
        cin >> n;
        for(long long i = 0; i < n; i ++)
        {
            cin >> arr[i];
            if(i == 0)
                res1 = arr[i];
            else
                res1 ^= arr[i];
            res2 += arr[i];
        }
        long long naum = 0;

        string a1 = "", a2 = "", a3 = "";
        res1 <<= 1;
        cout << 3 << endl;
        while(res1 || res2)
        {
            if(((res2 + naum) & 1) == (res1 & 1))
            {
                a1 = "0" + a1;
                a2 = "0" + a2;
                a3 = "0" + a3;
                res2 >>= 1;
                res1 >>= 1;
            }
            else
            {
                naum = 0;
                a1 = "1" + a1;
                a2 = "0" + a2;
                a3 = "0" + a3;
                res2 >>= 1;
                res1 >>= 1;
            }
        }
        if(naum) a1 = "1" + a1;
        cout << toint(a1) << " " << toint(a2) << " " << toint(a3) << endl;

    }

    return 0;
}
/**
1
5 3
3 1 5 4 2
5 3 2
*/


#include <bits/stdc++.h>
using namespace std;
#define fi			first
#define se			second
#define fz(i,a,b)	for(int i=a;i<=b;i++)
#define fd(i,a,b)	for(int i=a;i>=b;i--)
#define put(x)		putchar(x)
#define eoln        put('\n')
#define space		put(' ')
#define int long long
inline int read(){
	int x=0,neg=1;char c=getchar();
	while(!isdigit(c)){
		if(c=='-')	neg=-1;
		c=getchar();
	}
	while(isdigit(c))	x=x*10+c-'0',c=getchar();
	return x*neg;
}
inline void print(int x){
	if(x<0){
		putchar('-');
		print(abs(x));
		return;
	}
	if(x<=9)	putchar(x+'0');
	else{
		print(x/10);
		putchar(x%10+'0');
	}
}
int T=read(),n,a[100005];
inline void solve(){
	n=read();
	int x=0,sum=0;
	fz(i,1,n)	a[i]=read(),sum+=a[i],x^=a[i];
	cout<<2<<endl<<x<<" "<<sum+x<<endl;
}
signed main(){
	while(T--)	solve();
	return 0;
}


#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
using namespace std;
#define N 200005
#define ll long long
ll base=(1ll<<40)-2;
int n;
ll a[N],sum=0,x,y;
int main(){
    int T;scanf("%d",&T);
    while(T--){
scanf("%d",&n);x=base;sum=0;
for(int i=1;i<=n;i++){scanf("%lld",a+i);x^=a[i];sum+=a[i];}
sum+=x;
y=base-sum/2;
printf("3\n%lld %lld %lld\n",x,y,y);
    }
}


#include<iostream>
#include<cstdio>
#include<queue>
#include<map>
#define ll long long
using namespace std;

int read(){
	char a=getchar();int b=1,n=0;
	while(a<'0'||a>'9'){if(a=='-')b=-1;a=getchar();}
	while(a>='0'&&a<='9')n=n*10+a-48,a=getchar();
	return n*b;
}
int main(){
	int t=read();
	while(t--){
		long long n=read(),h=0,xr=0,s;
		while(n--){
			s=read();
			h+=s;
			xr^=s;
		}
		h+=xr;
		cout<<2<<endl<<h<<' '<<xr<<endl;
	}
	return 0;
}


#include <cstdio>
int t,n;
long long x,y,z;
int main()
{
	scanf("%d",&t);
	while(t--)
	{
		scanf("%d",&n),x=y=0;
		for(int i=1;i<=n;i++)
			scanf("%lld",&z),x+=z,y^=z;
		printf("2\n");
			printf("%lld %lld\n",y,x+y);
	}
}


#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 5;
int a[N];
int main() {
	ios::sync_with_stdio(0);
	int T; cin >> T;
	while (T--) {
		int n; cin >> n; memset(a, 0, sizeof a);
		for (int i = 1; i <= n; i++)
			cin >> a[i];
		int s = 0, xs = 0;
		for (int i = 1; i <= n; i++) s += a[i], xs ^= a[i];
		cout << 2 << endl;
		cout << xs << " " << s + xs << endl;
	}
	return 0;
}


#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
using namespace std;
#define N 200005
#define ll long long
ll base=(1ll<<58)-2;
int n;
ll a[N],sum=0,x,y;
int main(){
    // cout<<base<<endl;
    int T;scanf("%d",&T);
    while(T--){
scanf("%d",&n);x=base;sum=0;
for(int i=1;i<=n;i++){scanf("%lld",a+i);x^=a[i];sum+=a[i];}
sum+=x;
y=base-sum/2;
printf("3\n%lld %lld %lld\n",x,y,y);
    }
}


#include<bits/stdc++.h>
#include<string.h>
#define ll long long
#define pb push_back
using namespace std;
int main()
{
	int t;
	cin>>t;
	for(int u=0;u<t;u++)
	{
		int n;
		cin>>n;
		ll k=0,s=0;
		for(int i=0;i<n;i++)
		{
			ll a;
			cin>>a;
			s+=a;
			k=a^k;
		}
		int y;
		if(k==0)
		{
			y=2;
		}
		else
		{
			y=log2(s);
		}
		ll o=y+1;
		o=pow(2,o)-2;
		ll p=o^k;//ba k ke xor beshe mishe 1110(o)
		s+=p;
		k=k^p;
		ll d=2*k-s;
		cout<<3<<endl<<p<<" "<<d/2<<" "<<d/2<<endl;
	}
}


#include<bits/stdc++.h>
#include<string.h>
#define ll long long
#define pb push_back
using namespace std;
int main()
{
	int t;
	cin>>t;
	for(int u=0;u<t;u++)
	{
		int n;
		cin>>n;
		ll k=0,s=0;
		for(int i=0;i<n;i++)
		{
			ll a;
			cin>>a;
			s+=a;
			k=a^k;
		}
		int y;
		if(k==0)
		{
			y=2;
		}
		else
		{
			y=log2(k);
		}
		ll o=y+1;
		o=pow(2,o)-2;
		ll p=o^k;//ba k ke xor beshe mishe 1110(o)
		s+=p;
		k=k^p;
		ll d=2*k-s;
		cout<<y<<" "<<k<<endl;
		cout<<3<<endl<<p<<" "<<d/2<<" "<<d/2<<endl;
	}
}


#include<bits/stdc++.h>
#include<string.h>
#define ll long long
#define pb push_back
using namespace std;
int main()
{
	int t;
	cin>>t;
	for(int u=0;u<t;u++)
	{
		int n;
		cin>>n;
		ll k=0,s=0;
		for(int i=0;i<n;i++)
		{
			ll a;
			cin>>a;
			s+=a;
			k=a^k;
		}
		int y;
		if(k==0)
		{
			y=2;
		}
		else
		{
			y=log2(k);
		}
		ll o=y+1;
		o=pow(2,o)-2;
		ll p=o^k;//ba k ke xor beshe mishe 1110(o)
		s+=p;
		k=k^p;
		ll d=2*k-s;
		cout<<3<<endl<<p<<" "<<d/2<<" "<<d/2<<endl;
	}
}


#include<bits/stdc++.h>
#include<string.h>
#define ll long long
#define pb push_back
using namespace std;
int main()
{
	int t;
	cin>>t;
	for(int u=0;u<t;u++)
	{
		int n;
		cin>>n;
		ll k=0,s=0;
		for(int i=0;i<n;i++)
		{
			ll a;
			cin>>a;
			s+=a;
			k=a^k;
		}
		int y;
		if(k==0)
		{
			y=2;
		}
		else
		{
			y=log2(s);
		}
		ll o=y+3;
		o=pow(2,o)-2;
		ll p=o^k;//ba k ke xor beshe mishe 1110(o)
		s+=p;
		k=k^p;
		ll d=2*k-s;
		cout<<3<<endl<<p<<" "<<d/2<<" "<<d/2<<endl;
	}
}


#include<bits/stdc++.h>
#include<string.h>
#define ll long long
#define pb push_back
using namespace std;
int main()
{
	int t;
	cin>>t;
	for(int u=0;u<t;u++)
	{
		int n;
		cin>>n;
		ll k=0,s=0;
		for(int i=0;i<n;i++)
		{
			ll a;
			cin>>a;
			s+=a;
			k=a^k;
		}
		int y;
		if(k==0)
		{
			y=2;
		}
		else
		{
			y=log2(k);
		}
		ll o=y+5;
		o=pow(2,o)-2;
		ll p=o^k;//ba k ke xor beshe mishe 1110(o)
		s+=p;
		k=k^p;
		ll d=2*k-s;
		cout<<3<<endl<<p<<" "<<d/2<<" "<<d/2<<endl;
	}
}


#include<bits/stdc++.h>
#include<string.h>
#define ll long long
#define pb push_back
using namespace std;
int main()
{
	int t;
	cin>>t;
	for(int u=0;u<t;u++)
	{
		int n;
		cin>>n;
		ll k=0,s=0;
		for(int i=0;i<n;i++)
		{
			ll a;
			cin>>a;
			s+=a;
			k=a^k;
		}
		int y;
		if(k==0)
		{
			y=2;
		}
		else
		{
			y=log2(k);
		}
		ll o=y+10;
		o=pow(2,o)-2;
		ll p=o^k;//ba k ke xor beshe mishe 1110(o)
		s+=p;
		k=k^p;
		ll d=2*k-s;
		cout<<3<<endl<<p<<" "<<d/2<<" "<<d/2<<endl;
	}
}


#include <iostream>

using namespace std;
long long n, t, a, s, x;
int main()
{
    cin>>t;
    for(int q=1; q<=t; q++)
    {
        cin>>n;
        x=0; s=0;
        for(int i=1; i<=n; i++)
        {
            cin>>a;
            x^=a; s+=a;
        }
        cout<<"2\n"<<x<<" "<<s+x<<"\n";
    }
    return 0;
}


#include <iostream>

using namespace std;
int n, t, a, s, x;
int main()
{
    cin>>t;
    for(int q=1; q<=t; q++)
    {
        cin>>n;
        x=0; s=0;
        for(int i=1; i<=n; i++)
        {
            cin>>a;
            x^=a; s+=a;
        }
        if(s!=x)
            cout<<0<<"\n\n";
        else
            cout<<"2\n"<<x<<" "<<s+x<<"\n";
    }
    return 0;
}


#include <iostream>

using namespace std;
int n, t, a, s, x;
int main()
{
    cin>>t;
    for(int q=1; q<=t; q++)
    {
        cin>>n;
        x=0; s=0;
        for(int i=1; i<=n; i++)
        {
            cin>>a;
            x^=a; s+=a;
        }
        if(s==x)
            cout<<0<<"\n\n";
        else
            cout<<"2\n"<<x<<" "<<s+x<<"\n";
    }
    return 0;
}


#include <iostream>

using namespace std;
int n, t, a, s, x;
int main()
{
    cin>>t;
    for(int q=1; q<=t; q++)
    {
        cin>>n;
        x=0; s=0;
        for(int i=1; i<=n; i++)
        {
            cin>>a;
            x^=a; s+=a;
        }
        if(s!=x)
            cout<<0<<"\n\n";
        else
            cout<<2<<"\n"<<s<<" "<<s+x<<"\n";
    }
    return 0;
}


#include <iostream>

using namespace std;
int t, n, a[200010], vf, ok;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cin>>t;
    for(int q=1; q<=t; q++)
    {
        cin>>n; ok=0;
        for(int i=1; i<=n; i++)
            cin>>a[i];
        for(int i=2; i<=n; i++)
            if(abs(a[i]-a[i-1])>=2)
                {cout<<"YES\n"<<i-1<<" "<<i<<"\n"; ok=1; break;}
        if(ok==0)
            cout<<"NO\n";
    }
    return 0;
}


#include <iostream>

using namespace std;
long long n, t, a, s, x;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cin>>t;
    for(int q=1; q<=t; q++)
    {
        cin>>n;
        x=0; s=0;
        for(int i=1; i<=n; i++)
        {
            cin>>a;
            x^=a; s+=a;
        }
        cout<<"2\n"<<x<<" "<<s+x<<"\n";
    }
    return 0;
}


#include <iostream>

using namespace std;
int n, t, a, s, x;
int main()
{
    cin>>t;
    for(int q=1; q<=t; q++)
    {
        cin>>n;
        x=0; s=0;
        for(int i=1; i<=n; i++)
        {
            cin>>a;
            x^=a; s+=a;
        }
        cout<<"2\n"<<x<<" "<<s+x<<"\n";
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main(){
	int t,n,k,j=0;
	long long sum=0;
	scanf("%d",&t);
	while(t--){
		sum=0;
		scanf("%d",&n);
		for(int i=0;i<n;i++){
			scanf("%d",&k);
			sum+=k;
		}
		if(sum%2){
			printf("%d\n",2);
			printf("%lld %lld\n",sum,2*sum);
		}
		else{
			printf("%d\n",2);
			printf("%lld %lld\n",sum/2,sum/2);
		}
	}
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
int a[200001];
int main(){
	int t,n,ma=-1,mi=1000000001,k,l,r;
	scanf("%d",&t);
	while(t--){
		ma=-1;mi=1000000001;
		int flag=0;
		memset(a,0,sizeof(a));
		scanf("%d",&n);
		scanf("%d",&a[1]);
		for(int i=2;i<=n;i++){
			scanf("%d",&a[i]);
			if(!flag){
			if(abs(a[i]-a[i-1])>1){flag=1;l=i-1;r=i;}}
		}
	    if(flag){printf("YES\n");printf("%d %d\n",l,r);}else printf("NO\n");
	}
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
int a[100001];
int main(){
	int t,n;
	long long sum=0,ans=0;
	scanf("%d",&t);
	while(t--){
		sum=0,ans=0;
		scanf("%d",&n);
		for(int i=0;i<n;i++){
			scanf("%d",&a[i]);
			sum+=a[i];
		}
		sort(a,a+n);
		for(int i=0;i<n;i++){
			ans^=a[i];
		}
		if(ans!=0){
		   sum+=ans;
		   printf("%d\n",2);
		   printf("%lld %lld\n",ans,sum);}
		else{
			printf("%d\n",1);
			printf("%lld\n",sum);
		}
	}
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main(){
	int t,n,k,j=0;
	long long sum=0;
	scanf("%d",&t);
	while(t--){
		sum=0;
		scanf("%d",&n);
		for(int i=0;i<n;i++){
			scanf("%d",&k);
			sum+=k;
		}
		if(sum%2){
			printf("%d\n",2);
			printf("%lld %lld\n",sum,2*sum);
		}
		else{
			printf("%d\n",2);
			printf("%lld %lld\n",sum,sum*2);
		}
	}
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
int a[100001];
int main(){
	int t,n,ans=0;
	long long sum=0;
	scanf("%d",&t);
	while(t--){
		sum=0,ans=0;
		scanf("%d",&n);
		for(int i=0;i<n;i++){
			scanf("%d",&a[i]);
			sum+=a[i];
		}
		sort(a,a+n);
		for(int i=0;i<n;i++){
			ans^=a[i];
		}
		if(ans!=0){
		   sum+=ans;
		   printf("%d\n",2);
		   printf("%lld %lld\n",ans,sum);}
		else{
			printf("%d\n",1);
			printf("%lld\n",sum);
		}
	}
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main(){
	int t,n,k,j=0;
	long long sum=0;
	scanf("%d",&t);
	while(t--){
		sum=0;
		scanf("%d",&n);
		for(int i=0;i<n;i++){
			scanf("%d",&k);
			sum+=k;
		}
		if(sum%2){
			printf("%d\n",2);
			printf("%lld %lld\n",sum,2*sum);
		}
		else{
			printf("%d\n",2);
			printf("%lld\n",sum/2,sum/2);
		}
	}
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main(){
	int t,n,k,j=0;
	long long sum=0;
	scanf("%d",&t);
	while(t--){
		sum=0;
		scanf("%d",&n);
		for(int i=0;i<n;i++){
			scanf("%d",&k);
			sum+=k;
		}
		if(sum%2){
			printf("%d\n",2);
			printf("%lld %lld\n",sum,2*sum);
		}
		else{
			printf("%d\n",1);
			printf("%lld\n",sum);
		}
	}
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main(){
	int t,n,k;
	long long ans=0;
	scanf("%d",&t);
	while(t--){
		scanf("%d",&n);
		for(int i=0;i<n;i++){
			scanf("%d",&k);
			ans+=k;
		}
		printf("1\n");
		printf("%lld\n",ans);
	}
	return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main()
{
    int t;
    cin >> t;
    while(t--)
    {
        int n , x , sum = 0 , xo = 0;
        cin >> n;
        for(int i = 0 ; i < n ; i++)
        {
            cin >> x;
            sum += x;
            xo ^= x;
        }
        cout << "2\n" << xo << " " << sum + xo << endl;
    }
}


#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

int main()
{
    int t;
    cin >> t;
    while(t--)
    {
        ll n , x , sum = 0 , xo = 0;
        cin >> n;
        for(int i = 0 ; i < n ; i++)
        {
            cin >> x;
            sum += x;
            xo ^= x;
        }
        cout << "2\n" << xo << " " << sum + xo << endl;
    }
}


#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

int main()
{
    int qu;
    cin >> qu;
    while(qu--){
        ll n,sum = 0,xo = 0;
        vector<ll> v;
        cin >> n;
        queue<ll> q;
        for(int i = 0; i < n; i ++){
            ll a;
            cin >> a;
            sum += a;
            xo ^= a;
            v.push_back(a);
        }
        ll div = abs(sum - (2*xo));

        if(div & 1){
            xo ^= 1;
            sum ++;
            q.push(1);
            div = abs(sum - 2*xo);
        }
        else if(sum == 2*xo){
            cout << 0 << endl;
            continue;
        }

        if(sum < 2*xo ){
            q.push(div/2);
            q.push(div/2);
        }
        else{
            int j = 0;
            sum += xo;
            if(xo)
                q.push(xo);
            q.push(sum);
//            while(2*xo != sum && q.size() < 3 ){
//                div = abs(2*xo - sum);
//                q.push(div);
//                xo ^= div;
//                sum += div;
//                j++;
//            }
        }
        cout << q.size() << endl;
        while(!q.empty()){
            cout << q.front() << ' ';
            q.pop();
        }
        cout << endl;

    }
}


#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

int main()
{
    int qu;
    cin >> qu;
    while(qu--){
        ll n,sum = 0,xo = 0;
        vector<ll> v;
        cin >> n;
        queue<ll> q;
        for(int i = 0; i < n; i ++){
            ll a;
            cin >> a;
            sum += a;
            xo ^= a;
            v.push_back(a);
        }
        ll div = abs(sum - (2*xo));
        if(div & 1){
            xo ^= 1;
            sum ++;
            q.push(1);
            div = abs(sum - 2*xo);
        }
        if(sum == 2*xo){
            cout << 0 << endl;
            continue;
        }

        if(sum < 2*xo ){
            q.push(div/2);
            q.push(div/2);
        }
        else{
            int j = 0;
            while(2*xo != sum && q.size() < 3 && sum != 2*xo){
                div = abs(xo - sum);
                q.push(div);
                xo ^= div;
                sum += div;
                j++;
            }
        }
        cout << q.size() << endl;
        while(!q.empty()){
            cout << q.front() << ' ';
            q.pop();
        }
        cout << endl;

    }
}


#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

int main()
{
    int qu;
    cin >> qu;
    while(qu--){
        ll n,sum = 0,xo = 0;
        vector<ll> v;
        cin >> n;
        queue<ll> q;
        for(int i = 0; i < n; i ++){
            ll a;
            cin >> a;
            sum += a;
            xo ^= a;
            v.push_back(a);
        }
        ll div = abs(sum - (2*xo));
        if(div & 1){
            xo ^= 1;
            sum ++;
            q.push(1);
            div = abs(sum - 2*xo);
        }
        if(sum == 2*xo){
            cout << 0 << endl;
            continue;
        }

        if(sum < 2*xo ){
            q.push(div/2);
            q.push(div/2);
        }
        else{
            int j = 0;
            while(2*xo != sum && q.size() < 3 ){
                div = abs(2*xo - sum);
                q.push(div);
                xo ^= div;
                sum += div;
                j++;
            }
        }
        cout << q.size() << endl;
        while(!q.empty()){
            cout << q.front() << ' ';
            q.pop();
        }
        cout << endl;

    }
}


#include <bits/stdc++.h>

using namespace std;

// 1 2 4 8 16 32 64 128 256 1024 2048 4096
typedef long long ll;

int main()
{
    int qu;
    cin >> qu;
    while(qu--){
        ll n,sum = 0,xo = 0;
        vector<ll> v;
        cin >> n;
        queue<ll> q;
        for(int i = 0; i < n; i ++){
            ll a;
            cin >> a;
            sum += a;
            xo ^= a;
            v.push_back(a);
        }
        if(sum == 2*xo){
            cout << 0 << endl;
            continue;
        }

        else if(sum < 2*xo){
            ll div = abs(sum - (2*xo));
            q.push(div/2);
            q.push(div/2);
        }
        else{
            int j = 0;
            while(2*xo != sum && j < 3){
                ll div = abs((2*xo) - sum);
                q.push(div);
                xo ^= div;
                sum += div;
                if(sum < 2*xo){
                    div = abs(sum - 2*xo);
                    q.push(div/2);
                    q.push(div/2);
                    break;
                }
                j++;
            }
        }
        cout << q.size() << endl;
        while(!q.empty()){
            cout << q.front() << ' ';
            q.pop();
        }
        cout << endl;

    }
}


#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

int main()
{
    int qu;
    cin >> qu;
    while(qu--){
        ll n,sum = 0,xo = 0;
        vector<ll> v;
        cin >> n;
        queue<ll> q;
        for(int i = 0; i < n; i ++){
            ll a;
            cin >> a;
            sum += a;
            xo ^= a;
            v.push_back(a);
        }
        ll div = abs(sum - (2*xo));
        if(sum == 2*xo){
            cout << 0 << endl;
            continue;
        }

        if(sum < 2*xo && !(div&1) ){
            q.push(div/2);
            q.push(div/2);
        }
        else{
            int j = 0;
            while(2*xo != sum && j < 3){
                if(div & 1){
                    div/=3;
                }
                q.push(div);
                xo ^= div;
                sum += div;
                if(sum < 2*xo){
                    div = abs(sum - 2*xo);
                    q.push(div/2);
                    q.push(div/2);
                    break;
                }
                j++;
            }
        }
        cout << q.size() << endl;
        while(!q.empty()){
            cout << q.front() << ' ';
            q.pop();
        }
        cout << endl;

    }
}


#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

int main()
{
    int qu;
    cin >> qu;
    while(qu--){
        ll n,sum = 0,xo = 0;
        vector<ll> v;
        cin >> n;
        queue<ll> q;
        for(int i = 0; i < n; i ++){
            ll a;
            cin >> a;
            sum += a;
            xo ^= a;
            v.push_back(a);
        }
        ll div = abs(sum - (2*xo));

        if(div & 1 && sum != 2* xo){
            xo ^= 1;
            sum ++;
            q.push(1);
            div = abs(sum - 2*xo);
        }
        else if(sum == 2*xo){
            cout << 0 << endl;
            continue;
        }

        if(sum < 2*xo ){
            q.push(div/2);
            q.push(div/2);
        }
        else{
            int j = 0;
            while(2*xo != sum && q.size() < 3 ){
                div = abs(2*xo - sum);
                q.push(div);
                xo ^= div;
                sum += div;
                j++;
            }
        }
        cout << q.size() << endl;
        while(!q.empty()){
            cout << q.front() << ' ';
            q.pop();
        }
        cout << endl;

    }
}