#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using ii = pair<int, int>;
using vi = vector<int>;
using vll = vector<ll>;
using vii = vector<ii>;
const ll MOD = 998244353;
const int INF = 1e9+9;
const int MAXN = 1000006;

int t, n, m, k, arr[MAXN];

int main () {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> t;
  while (t--) {
    cin >> n;
    ll s = 0, x = 0;
    for (int i = 0, j; i < n; i++) {
      cin >> j;
      s+=j;
      x^=j;
    }
    ll ans1=0, ans2=0, ans3=0;
    ll d = s-2*x;
    if (d < 0) {
      if (d&1) {
        ans3 = 1;
        s+=1;
        x^=1;
        d = s-2*x;
      }
    }
    if (d>0) {
      for (ll i = 0; i < 62; i++) {
        if (d&(1<<i)) {
          if (x&(1<<i)) {
            ans1 |= (1<<i);
            d+=(1<<i)+(1<<(i+1));
          } else {
            ans1 |= (1<<i);
            d-=(1<<i);
          }
        }
      }
    } else if (d < 0) {
      ans1 = -d/2;
      ans2 = -d/2;
    }

    cout << "3\n" << ans1 << ' ' << ans2 << ' ' << ans3 << '\n';
  }

}


#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using ii = pair<int, int>;
using vi = vector<int>;
using vll = vector<ll>;
using vii = vector<ii>;
const ll MOD = 998244353;
const int INF = 1e9+9;
const int MAXN = 1000006;

ll t, n, m, k, arr[MAXN];

int main () {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> t;
  while (t--) {
    ll s = 0, x = 0;
    cin >> n;
    for (ll i = 0, j; i < n; i++) {
      cin >> j;
      s+=j;
      x^=j;
    }

    ll ans1=0, ans2=0, ans3=0;
    ll d = s-2*x;
    if (d < 0) {
      if ((-d)&1) {
        ans3 = 1;
        s+=1;
        x^=1;
        d = s-2*x;
      }
    }

    if (d>0) {
      for (ll i = 0; i < 62; i++) {
        if (d&(1<<i)) {
          if (x&(1<<i)) {
            ans1 |= (1<<i);
            d+=(1<<i)+(1<<(i+1));
          } else {
            ans1 |= (1<<i);
            d-=(1<<i);
          }
        }
      }
      //assert(d==0);
    } else if (d < 0) {
      //assert(((-d)%2)==0);
      ans1 = -d/2;
      ans2 = -d/2;
    }

    cout << "3\n" << ans1 << ' ' << ans2 << ' ' << ans3 << '\n';
  }

}


#include<bits/stdc++.h>
using namespace std;
using ll = unsigned long long;
using ii = pair<int, int>;
using vi = vector<int>;
using vll = vector<ll>;
using vii = vector<ii>;
const ll MOD = 998244353;
const int INF = 1e9+9;
const int MAXN = 1000006;

ll t, n, m, k, arr[MAXN];

int main () {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> t;
  while (t--) {
    ll s = 0, x = 0;
    cin >> n;
    for (ll i = 0, j; i < n; i++) {
      cin >> j;
      s+=j;
      x^=j;
    }

    ll ans1=0, ans2=0, ans3=0;
    ll d = s-2*x;
    if (d < 0) {
      if ((-d)&1) {
        ans3 = 1;
        s+=1;
        x^=1;
        d = s-2*x;
      }
    }

    if (d>0) {
      for (ll i = 0; i < 59; i++) {
        if (d&(1LL<<i)) {
          if (x&(1LL<<i)) {
            ans1 |= (1LL<<i);
            d+=(1LL<<i)+(1LL<<(i+1));
          } else {
            ans1 |= (1LL<<i);
            d-=(1LL<<i);
          }
        }
      }
      assert(d==0);
    } else if (d < 0) {
      assert(((-d)%2)==0);
      ans1 = -d/2;
      ans2 = -d/2;
    }

    cout << "3\n" << ans1 << ' ' << ans2 << ' ' << ans3 << '\n';
  }

}


#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using ii = pair<int, int>;
using vi = vector<int>;
using vll = vector<ll>;
using vii = vector<ii>;
const ll MOD = 998244353;
const int INF = 1e9+9;
const int MAXN = 1000006;

ll t, n, m, k, arr[MAXN];

int main () {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> t;
  while (t--) {
    ll s = 0, x = 0;
    cin >> n;
    for (ll i = 0, j; i < n; i++) {
      cin >> j;
      s+=j;
      x^=j;
    }

    ll ans1=0, ans2=0, ans3=0;
    ll d = s-2*x;
    if (d < 0) {
      if ((-d)&1) {
        ans3 = 1;
        s+=1;
        x^=1;
        d = s-2*x;
      }
    }
    if (d>0) {
      for (ll i = 0; i < 62; i++) {
        if (d&(1<<i)) {
          if (x&(1<<i)) {
            ans1 |= (1<<i);
            d+=(1<<i)+(1<<(i+1));
          } else {
            ans1 |= (1<<i);
            d-=(1<<i);
          }
        }
      }
      assert(d==0);
    } else if (d < 0) {
      assert(((-d)&1)==0);
      ans1 = -d/2;
      ans2 = -d/2;
    }

    cout << "3\n" << ans1 << ' ' << ans2 << ' ' << ans3 << '\n';
  }

}


#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using ii = pair<int, int>;
using vi = vector<int>;
using vll = vector<ll>;
using vii = vector<ii>;
const ll MOD = 998244353;
const int INF = 1e9+9;
const int MAXN = 1000006;

ll t, n, m, k, arr[MAXN];

int main () {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> t;
  while (t--) {
    ll s = 0, x = 0;
    cin >> n;
    for (ll i = 0, j; i < n; i++) {
      cin >> j;
      s+=j;
      x^=j;
    }

    ll ans1=0, ans2=0, ans3=0;
    ll d = s-2*x;
    if (d < 0) {
      if ((-d)&1) {
        ans3 = 1;
        s+=1;
        x^=1;
        d = s-2*x;
      }
    }
    if (d>0) {
      for (ll i = 0; i < 62; i++) {
        if (d&(1<<i)) {
          if (x&(1<<i)) {
            ans1 |= (1<<i);
            d+=(1<<i)+(1<<(i+1));
          } else {
            ans1 |= (1<<i);
            d-=(1<<i);
          }
        }
      }
      assert(d==0);
    } else if (d < 0) {
      assert((d&1)==0);
      ans1 = -d/2;
      ans2 = -d/2;
    }

    cout << "3\n" << ans1 << ' ' << ans2 << ' ' << ans3 << '\n';
  }

}


#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using ii = pair<int, int>;
using vi = vector<int>;
using vll = vector<ll>;
using vii = vector<ii>;
const ll MOD = 998244353;
const int INF = 1e9+9;
const int MAXN = 1000006;

int t, n, m, k, arr[MAXN];

int main () {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> t;
  while (t--) {
    cin >> n;
    ll s = 0, x = 0;
    for (int i = 0, j; i < n; i++) {
      cin >> j;
      s+=j;
      x^=j;
    }
    ll ans1=0, ans2=0, ans3=0;
    ll d = s-2*x;
    if (d < 0) {
      if (d&1) {
        ans3 = 1;
        s+=1;
        x^=1;
        d = s-2*x;
      }
    }
    if (d>0) {
      for (ll i = 0; i < 62; i++) {
        if (d&(1<<i)) {
          if (x&(1<<i)) {
            ans1 |= (1<<i);
            d+=(1<<i)+(1<<(i+1));
          } else {
            ans1 |= (1<<i);
            d-=(1<<i);
          }
        }
      }
    } else if (d < 0) {
      ans2 = -d/2;
      ans3 = -d/2;
    }

    cout << "3\n" << ans1 << ' ' << ans2 << ' ' << ans3 << '\n';
  }

}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn = 2e5 + 100;
const ll inf = 1e6 + 100;
ll a[maxn];
int main() {
	ios::sync_with_stdio(0);
	ll t;
	cin >> t;
	while (t--) {
		ll n;
		cin >> n;
		ll sum1 = 0, sum2 = 0;
		for (int i = 1; i <= n; i++)
			cin >> a[i], sum1 += a[i], sum2 ^= a[i];
		if (sum1 == 2 * sum2)
			cout << 0 << endl << endl;
		else {
			if (sum1 % 2 == 0) {
				ll w = 2 * inf;
				cout << 3 << endl;
				cout << w << " " << (2 * (sum2 ^ w) - (sum1 + w)) / 2 << " " << (2 * (sum2 ^ w) - (sum1 + w)) / 2 << endl;
			}
			else {
				ll w = 2 * inf + 1;
				cout << 3 << endl;
				cout << w << " " << (2 * (sum2 ^ w) - (sum1 + w)) / 2 << " " << (2 * (sum2 ^ w) - (sum1 + w)) / 2 << endl;
			}
		}
	}
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn = 2e5 + 100;
const ll inf = 1e7 + 100;
ll a[maxn];
int main() {
	ios::sync_with_stdio(0);
	ll t;
	cin >> t;
	while (t--) {
		ll n;
		cin >> n;
		ll sum1 = 0, sum2 = 0;
		for (int i = 1; i <= n; i++)
			cin >> a[i], sum1 += a[i], sum2 ^= a[i];
		if (sum1 == 2 * sum2)
			cout << 0 << endl << endl;
		else {
			if (sum1 % 2 == 0) {
				ll w = 2 * inf;
				cout << 3 << endl;
				cout << w << " " << (2 * (sum2 ^ w) - (sum1 + w)) / 2 << " " << (2 * (sum2 ^ w) - (sum1 + w)) / 2 << endl;
			}
			else {
				ll w = 2 * inf + 1;
				cout << 3 << endl;
				cout << w << " " << (2 * (sum2 ^ w) - (sum1 + w)) / 2 << " " << (2 * (sum2 ^ w) - (sum1 + w)) / 2 << endl;
			}
		}
	}
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn = 2e5 + 100;
const ll inf = 1e7 + 100;
ll a[maxn];
int main() {
	ios::sync_with_stdio(0);
	ll t;
	cin >> t;
	while (t--) {
		ll n;
		cin >> n;
		ll sum1 = 0, sum2 = 0;
		for (int i = 1; i <= n; i++)
			cin >> a[i], sum1 += a[i], sum2 ^= a[i];
		if (sum1 == 2 * sum2)
			cout << 0 << endl << endl;
		else {
			if (sum1 % 2 == 0) {
				ll w = 2 * sum1;
				cout << 3 << endl;
				cout << w << " " << (2 * (sum2 ^ w) - (sum1 + w)) / 2 << " " << (2 * (sum2 ^ w) - (sum1 + w)) / 2 << endl;
			}
			else {
				ll w = 2 * sum1 + 1;
				cout << 3 << endl;
				cout << w << " " << (2 * (sum2 ^ w) - (sum1 + w)) / 2 << " " << (2 * (sum2 ^ w) - (sum1 + w)) / 2 << endl;
			}
		}
	}
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn = 2e5 + 100;
const ll inf = 4e16 + 100;
ll a[maxn];
int main() {
	ios::sync_with_stdio(0);
	ll t;
	cin >> t;
	while (t--) {
		ll n;
		cin >> n;
		ll sum1 = 0, sum2 = 0;
		for (int i = 1; i <= n; i++)
			cin >> a[i], sum1 += a[i], sum2 ^= a[i];
		if (sum1 == 2ll * sum2)
			cout << 0 << endl << endl;
		else {
			if (sum1 % 2 == 0) {
				ll w = 2ll * inf;
				cout << 3 << endl;
				cout << w << " " << ((2 * (sum2 ^ w)) - (sum1 + w)) / 2 << " " << ((2 * (sum2 ^ w)) - (sum1 + w)) / 2 << endl;
			}
			else if (sum1 % 2 == 1) {
				ll w = 2ll * inf + 1ll;
				cout << 3 << endl;
				cout << w << " " << ((2 * (sum2 ^ w)) - (sum1 + w)) / 2 << " " << ((2 * (sum2 ^ w)) - (sum1 + w)) / 2 << endl;
			}
		}
	}
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn = 2e5 + 100;
const ll inf = 4e6 + 100;
ll a[maxn];
int main() {
	ios::sync_with_stdio(0);
	ll t;
	cin >> t;
	while (t--) {
		ll n;
		cin >> n;
		ll sum1 = 0, sum2 = 0;
		for (int i = 1; i <= n; i++)
			cin >> a[i], sum1 += a[i], sum2 ^= a[i];
		if (sum1 == 2ll*sum2)
			cout << 0 << endl << endl;
		else {
			if (sum1 % 2 == 0) {
				ll w = 2ll * inf;
				cout << 3 << endl;
				cout << w << " " << ((2 * (sum2 ^ w)) - (sum1 + w)) / 2 << " " << ((2 * (sum2 ^ w)) - (sum1 + w)) / 2 << endl;
			}
			else if (sum1 % 2 == 1) {
				ll w = 2ll * inf + 1ll;
				cout << 3 << endl;
				cout << w << " " << ((2 * (sum2 ^ w)) - (sum1 + w)) / 2 << " " << ((2 * (sum2 ^ w)) - (sum1 + w)) / 2 << endl;
			}
		}
	}
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn = 2e5 + 100;
const ll inf = 1e6 + 100;
ll a[maxn];
int main() {
	ios::sync_with_stdio(0);
	ll t;
	cin >> t;
	while (t--) {
		ll n;
		cin >> n;
		ll sum1 = 0, sum2 = 0;
		for (int i = 1; i <= n; i++)
			cin >> a[i], sum1 += a[i], sum2 ^= a[i];
		if (sum1 == 2ll * sum2)
			cout << 0 << endl << endl;
		else {
			if (sum1 % 2 == 0) {
				ll w = 2 * inf;
				cout << 3 << endl;
				cout << w << " " << ((2 * (sum2 ^ w)) - (sum1 + w)) / 2 << " " << ((2 * (sum2 ^ w)) - (sum1 + w)) / 2 << endl;
			}
			else if (sum1 % 2 == 1) {
				ll w = 2 * inf + 1;
				cout << 3 << endl;
				cout << w << " " << ((2 * (sum2 ^ w)) - (sum1 + w)) / 2 << " " << ((2 * (sum2 ^ w)) - (sum1 + w)) / 2 << endl;
			}
		}
	}
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn = 2e5 + 100;
const ll inf = 4e6 + 100;
ll a[maxn];
int main() {
	ios::sync_with_stdio(0);
	ll t;
	cin >> t;
	while (t--) {
		ll n, m;
		cin >> n;
		ll sum1 = 0, sum2 = 0;
		for (int i = 1; i <= n; i++)
			cin >> a[i], sum1 += a[i], sum2 ^= a[i];
		if (sum1 == 2ll * sum2)
			cout << 0 << endl << endl;
		else {
			if (sum1 % 2 == 0) {
				ll w = 10ll * sum1;
				sum2 ^= w;
				sum1 += w;
				cout << 3 << endl;
				cout << w << " " << ((2ll * sum2) - sum1) / 2ll << " " << ((2ll * sum2) - sum1) / 2ll << endl;
			}
			else if (sum1 % 2 == 1) {
				ll w = 10ll * sum1 + 1ll;
				sum2 ^= w;
				sum1 += w;
				cout << 3 << endl;
				cout << w << " " << ((2ll * sum2) - sum1) / 2ll << " " << ((2ll * sum2) - sum1) / 2ll << endl;
			}
		}
	}
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn = 2e5 + 100;
const ll inf = 4e6 + 100;
ll a[maxn];
int main() {
	ios::sync_with_stdio(0);
	ll t;
	cin >> t;
	while (t--) {
		ll n;
		cin >> n;
		ll sum1 = 0, sum2 = 0;
		for (int i = 1; i <= n; i++)
			cin >> a[i], sum1 += a[i], sum2 ^= a[i];
		if (sum1 == 2ll * sum2)
			cout << 0 << endl << endl;
		else {
			if (sum1 % 2 == 0) {
				ll w = 2ll * inf;
				cout << 3 << endl;
				cout << w << " " << ((2ll * (sum2 ^ w)) - (sum1 + w)) / 2ll << " " << ((2ll * (sum2 ^ w)) - (sum1 + w)) / 2ll << endl;
			}
			else if (sum1 % 2 == 1) {
				ll w = 2ll * inf + 1ll;
				cout << 3 << endl;
				cout << w << " " << ((2ll * (sum2 ^ w)) - (sum1 + w)) / 2ll << " " << ((2ll * (sum2 ^ w)) - (sum1 + w)) / 2ll << endl;
			}
		}
	}
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn = 2e5 + 100;
const ll inf = 1e6 + 100;
ll a[maxn];
int main() {
	ios::sync_with_stdio(0);
	ll t;
	cin >> t;
	while (t--) {
		ll n;
		cin >> n;
		ll sum1 = 0, sum2 = 0;
		for (int i = 1; i <= n; i++)
			cin >> a[i], sum1 += a[i], sum2 ^= a[i];
		if (sum1 == 2 * sum2)
			cout << 0 << endl << endl;
		else {
			if (sum1 % 2 == 0) {
				ll w = 2 * inf;
				cout << 3 << endl;
				cout << w << " " << ((2 * (sum2 ^ w)) - (sum1 + w)) / 2 << " " << ((2 * (sum2 ^ w)) - (sum1 + w)) / 2 << endl;
			}
			else if (sum1 % 2 == 1) {
				ll w = 2 * inf + 1;
				cout << 3 << endl;
				cout << w << " " << ((2 * (sum2 ^ w)) - (sum1 + w)) / 2 << " " << ((2 * (sum2 ^ w)) - (sum1 + w)) / 2 << endl;
			}
		}
	}
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn = 2e5 + 100;
const ll inf = 4e6 + 100;
ll a[maxn];
int main() {
	ios::sync_with_stdio(0);
	ll t;
	cin >> t;
	while (t--) {
		ll n;
		ll sum1 = 0, sum2 = 0;
		for (int i = 1; i <= n; i++)
			cin >> a[i], sum1 += a[i], sum2 ^= a[i];
		if (sum1 == 2ll * sum2)
			cout << 0 << endl << endl;
		else {
			if (sum1 % 2 == 0) {
				ll w = 2ll * inf;
				cout << 3 << endl;
				cout << w << " " << ((2ll * (sum2 ^ w)) - (sum1 + w)) / 2ll << " " << ((2ll * (sum2 ^ w)) - (sum1 + w)) / 2ll << endl;
			}
			else if (sum1 % 2 == 1) {
				ll w = 2ll * inf + 1ll;
				cout << 3 << endl;
				cout << w << " " << ((2ll * (sum2 ^ w)) - (sum1 + w)) / 2ll << " " << ((2ll * (sum2 ^ w)) - (sum1 + w)) / 2ll << endl;
			}
		}
	}
	return 0;
}


#include <bits/stdc++.h>
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <stack>
#include <set>
#include <map>
#include <unordered_map>
using namespace std;
#define Fio  ios_base::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr)
#define f(i, n) for (long long int i = 0; i < n; i++)
#define ll long long int
#define pb push_back
#define fi first
#define se second
const ll inf = 1e9 + 7;
const ll modc = 998244353;

int main(){
    Fio;
    ll t;
    cin>>t;
    while(t--){
        ll n;
        cin>>n;
        ll A[n];
        ll x=0,sum=0;
        f(i,n){
            cin>>A[i];
            sum=sum+A[i];
            x=x^A[i];
        }
        if(sum==2*x){
            cout<<"0"<<endl;
        }
        else{
            cout<<"2"<<endl;
            cout<<x<<" "<<sum+x<<endl;
        }
    }
    return 0;
}


#include <bits/stdc++.h>
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <stack>
#include <set>
#include <map>
#include <unordered_map>
using namespace std;
#define Fio  ios_base::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr)
#define f(i, n) for (long long int i = 0; i < n; i++)
#define ll long long int
#define pb push_back
#define fi first
#define se second
const ll inf = 1e9 + 7;
const ll modc = 998244353;

int main(){
    Fio;
    int t;
    cin>>t;
    while(t--){
        int n;
        cin>>n;
        int A[n];
        int x=0,sum=0;
        f(i,n){
            cin>>A[i];
            sum=sum+A[i];
            x=x^A[i];
        }
        if(sum==2*x){
            cout<<"0"<<endl;
        }
        else{
            cout<<"2"<<endl;
            cout<<x<<" "<<sum+x<<endl;
        }
    }
    return 0;
}


#include <bits/stdc++.h>
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
#define FastIO ios_base::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr)
#define f(i,n) for(int i=0;i<n;i++)
#define ll long long int
#define pb push_back
#define fi first
#define se second
const ll inf = 1e9+7;
const ll modc = 998244353;

int main(){
    FastIO;
    int t;
    cin>>t;
    while(t--){
        int n;
        cin>>n;
        vector<int>A(n);
        int sum=0,x=0;
        f(i,n){
        cin>>A[i];
        sum+=A[i];
        x=x^A[i];
        }
        ll a=x;
        sum=sum+x;
        ll b = sum;
        cout<<"2"<<endl;
        cout<<e1<<" "<<e2<<endl;
    }
    return 0;
}


#include <bits/stdc++.h>
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
#define FastIO ios_base::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr)
#define f(i,n) for(int i=0;i<n;i++)
#define ll long long int
#define pb push_back
#define fi first
#define se second
const ll inf = 1e9+7;
const ll modc = 998244353;

int main(){
    FastIO;
    int t;
    cin>>t;
    while(t--){
        int n;
        cin>>n;
        vector<int>A(n);
        int sum=0,x=0;
        f(i,n){
        cin>>A[i];
        sum+=A[i];
        x=x^A[i];
        }
        ll a=x;
        sum=sum+x;
        ll b = sum;
        cout<<"2"<<endl;
        cout<<a<<" "<<b<<endl;
    }
    return 0;
}


#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#define pb push_back
#define f(i,n) for(int i=0;i<n;i++)
using namespace std;

int main(){
    int t;
    cin>>t;
    while(t--){
        int n,a,sum=0;
        cin>>n;
        vector<int>A={};
        f(i,n){
            cin>>a;
            A.pb(a);
            sum=sum+a;
        }
        int & e=A[0];
        int x=e;
        for(int i=1;i<n;i++){
            int & f=A[i];
            x=x^f;
        }
        vector<int>B={};
        int m,c=0;
        if(sum==2*x)cout<<"0"<<endl<<endl;
        else if(sum!=2*x){
            int o=3;
            while(o--){
                m=2;
                if(x^m==(sum+m)/2){
                    B.pb(m);;
                    c++;
                    break;
                }
                m=m+4;
            }
            }
            if(c>=1){
                cout<<c<<endl;
                f(i,c){
                    int & e=B[i];
                    cout<<e<<" ";
                }
            }cout<<endl;
        }
        return 0;
    }


#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#define pb push_back
#define f(i,n) for(int i=0;i<n;i++)
using namespace std;

int main(){
    int t;
    cin>>t;
    while(t--){
        int n,a,sum=0;
        cin>>n;
        vector<int>A={};
        f(i,n){
            cin>>a;
            A.pb(a);
            sum=sum+a;
        }
        int & e=A[0];
        int x=e;
        for(int i=1;i<n;i++){
            int & f=A[i];
            x=x^f;
        }
        vector<int>B={};
        int m,c=0;
        if(sum==2*x)cout<<"0"<<endl;
        else if(sum!=2*x){
            int o=3;
            while(o--){
                m=2;
                if(x^m==(sum+m)/2){
                    B.pb(m);;
                    c++;
                    break;
                }
                m=m+4;
            }
            }
            if(c>=1){
                cout<<c<<endl;
                f(i,c){
                    int & e=B[i];
                    cout<<e<<" ";
                }
            }cout<<endl;
        }
        return 0;
    }


#include <bits/stdc++.h>
#define Speed ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
using namespace std;

#define st              first
#define nd              second
#define pb              push_back
#define pf              push_front
#define all(a)          (a).begin(), (a).end()
#define lwb             lower_bound
#define upb             upper_bound
#define vvll            vector<vector<ll> >
#define Mset(s, n)      memset(s, n, sizeof(s))
#define Sz(a)           int((a).size())
#define Max(a, b, c)    max(max((ll)(a), (ll)(b)), (ll)(c))
#define Min(a, b, c)    min(min((ll)(a), (ll)(b)), (ll)(c))
#define Unique(a)       sort(all(a)); (a).resize(unique(all(a)) - (a).begin())

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

const ll MOD = 1000000007;
const int oo = 2e9;
const ld PI = acos((ld) -1);
ll Getbit(ll x, ll k){return (x >> (k - 1)) & 1;}
ll Lcm(ll a, ll b) {return a / __gcd(a, b) * b;}
bool isPrime(ll n){for(ll i = 2; i * i <= n; i++){if(n % i == 0) return 0;} return (n > 1) ? 1 : 0;}
ll Powmod(ll n, ll k, ll p = MOD) {ll r = 1; for(; k; k /= 2, n = n * n % p){if(k & 1) r = r * n % p;} return r;}

const int N = 2e5 + 5;

ll n, m, k;
ull a[N], b[N];

void Solve(){
    cin >> n;
    ull add = 0, xr = 0;
    for(int i = 1; i <= n; i++){
        cin >> a[i];
        add += a[i];
        xr ^= a[i];
    }
    vector<ull> ans;
    ll res = 0;
    for(int i = 1; i <= 64; i++){
        if(Getbit(add, i) != Getbit(xr, i - 1)){
            res += 1 << (i - 1);
            add += 1 << (i - 1);
            xr ^= 1 << (i - 1);
        }

    }
    cout << "1\n" << res << "\n";

}

int main(){
    Speed;
    int query = 1; //
    cin >> query;
    while(query--){
        Solve();
    }
}


#include <bits/stdc++.h>
#define Speed ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
using namespace std;

#define st              first
#define nd              second
#define pb              push_back
#define pf              push_front
#define all(a)          (a).begin(), (a).end()
#define lwb             lower_bound
#define upb             upper_bound
#define vvll            vector<vector<ll> >
#define Mset(s, n)      memset(s, n, sizeof(s))
#define Sz(a)           int((a).size())
#define Max(a, b, c)    max(max((ll)(a), (ll)(b)), (ll)(c))
#define Min(a, b, c)    min(min((ll)(a), (ll)(b)), (ll)(c))
#define Unique(a)       sort(all(a)); (a).resize(unique(all(a)) - (a).begin())

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

const ll MOD = 1000000007;
const int oo = 2e9;
const ld PI = acos((ld) -1);
ll Getbit(ll x, ll k){return (x >> (k - 1)) & 1;}
ll Lcm(ll a, ll b) {return a / __gcd(a, b) * b;}
bool isPrime(ll n){for(ll i = 2; i * i <= n; i++){if(n % i == 0) return 0;} return (n > 1) ? 1 : 0;}
ll Powmod(ll n, ll k, ll p = MOD) {ll r = 1; for(; k; k /= 2, n = n * n % p){if(k & 1) r = r * n % p;} return r;}

const int N = 2e5 + 5;

ll n, m, k;
ll a[N], b[N];

void Solve(){
    cin >> n;
    ll add = 0, xr = 0;
    for(int i = 1; i <= n; i++){
        cin >> a[i];
        add += a[i];
        xr ^= a[i];
    }
    ll res = 0;
//    xor *= 2;
    vector<ll> ans;
    if(add & 1) {
        add += 1, ans.pb(1);
        xr ^= 1;
    }
    for(int i = 2; i <= 63; i++){
        if(Getbit(add, i) != Getbit(xr, i - 1)){
            res += 1 << (i - 1);
            add += 1 << (i - 1);
            xr ^= 1 << (i - 1);
            if(xr * 2 == add){
                break;
            }
        }

    }
    ans.pb(res);
    cout << Sz(ans) << "\n";
    for(ll x: ans) cout << x << " "; cout << "\n";

}

int main(){
    Speed;
    int query = 1; //
    cin >> query;
    while(query--){
        Solve();
    }
}


#include <bits/stdc++.h>
#define Speed ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
using namespace std;

#define st              first
#define nd              second
#define pb              push_back
#define pf              push_front
#define all(a)          (a).begin(), (a).end()
#define lwb             lower_bound
#define upb             upper_bound
#define vvll            vector<vector<ll> >
#define Mset(s, n)      memset(s, n, sizeof(s))
#define Sz(a)           int((a).size())
#define Max(a, b, c)    max(max((ll)(a), (ll)(b)), (ll)(c))
#define Min(a, b, c)    min(min((ll)(a), (ll)(b)), (ll)(c))
#define Unique(a)       sort(all(a)); (a).resize(unique(all(a)) - (a).begin())

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

const ll MOD = 1000000007;
const int oo = 2e9;
const ld PI = acos((ld) -1);
int Getbit(ll x, int k){return (x >> (k - 1)) & 1;}
ll Lcm(ll a, ll b) {return a / __gcd(a, b) * b;}
bool isPrime(ll n){for(ll i = 2; i * i <= n; i++){if(n % i == 0) return 0;} return (n > 1) ? 1 : 0;}
ll Powmod(ll n, ll k, ll p = MOD) {ll r = 1; for(; k; k /= 2, n = n * n % p){if(k & 1) r = r * n % p;} return r;}

const int N = 2e5 + 5;

ll n, m, k;
ll a[N], b[N];

void Solve(){
    cin >> n;
    ll add = 0, xr = 0;
    for(int i = 1; i <= n; i++){
        cin >> a[i];
        add += a[i];
        xr ^= a[i];
    }
    ll res = 0;
//    xor *= 2;
    vector<ll> ans;
    if(add & 1) {
        add += 1, ans.pb(1);
        if(xr & 1) xr--; else xr++;
    }
    for(int i = 2; i <= 18; i++){
//        bitset<16> d = add, p = xr;
//        cout << d << "\n" << p << endl << endl;
        if(Getbit(add, i) != Getbit(xr, i - 1)){
            res += 1 << (i - 1);
            add += 1 << (i - 1);
            xr ^= 1 << (i - 1);
            if(xr == add){
                break;
            }
        }

    }
    ans.pb(res);
    cout << Sz(ans) << "\n";
    for(ll x: ans) cout << x << " "; cout << "\n";

}

int main(){
    Speed;
    int query = 1; //
    cin >> query;
    while(query--){
        Solve();
    }
}


#include <bits/stdc++.h>
#define Speed ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
using namespace std;

#define st              first
#define nd              second
#define pb              push_back
#define pf              push_front
#define all(a)          (a).begin(), (a).end()
#define lwb             lower_bound
#define upb             upper_bound
#define vvll            vector<vector<ll> >
#define Mset(s, n)      memset(s, n, sizeof(s))
#define Sz(a)           int((a).size())
#define Max(a, b, c)    max(max((ll)(a), (ll)(b)), (ll)(c))
#define Min(a, b, c)    min(min((ll)(a), (ll)(b)), (ll)(c))
#define Unique(a)       sort(all(a)); (a).resize(unique(all(a)) - (a).begin())

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

const ll MOD = 1000000007;
const int oo = 2e9;
const ld PI = acos((ld) -1);
ll Getbit(ll x, ll k){return (x >> (k - 1)) & 1;}
ll Lcm(ll a, ll b) {return a / __gcd(a, b) * b;}
bool isPrime(ll n){for(ll i = 2; i * i <= n; i++){if(n % i == 0) return 0;} return (n > 1) ? 1 : 0;}
ll Powmod(ll n, ll k, ll p = MOD) {ll r = 1; for(; k; k /= 2, n = n * n % p){if(k & 1) r = r * n % p;} return r;}

const int N = 2e5 + 5;

ll n, m, k;
ll a[N], b[N];

void Solve(){
    cin >> n;
    ll add = 0, xr = 0;
    for(int i = 1; i <= n; i++){
        cin >> a[i];
        add += a[i];
        xr ^= a[i];
    }
    ll res = 0;
//    xor *= 2;
    vector<ll> ans;
    if(add & 1) {
        add += 1, ans.pb(1);
        xr ^= 1;
    }
    for(int i = 2; i <= 60; i++){
        if(Getbit(add, i) != Getbit(xr, i - 1)){
            res += 1 << (i - 1);
            add += 1 << (i - 1);
            xr ^= 1 << (i - 1);
            if(xr == add){
                break;
            }
        }

    }
    ans.pb(res);
    cout << Sz(ans) << "\n";
    for(ll x: ans) cout << x << " "; cout << "\n";

}

int main(){
    Speed;
    int query = 1; //
    cin >> query;
    while(query--){
        Solve();
    }
}


#include <bits/stdc++.h>
#define Speed ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
using namespace std;

#define st              first
#define nd              second
#define pb              push_back
#define pf              push_front
#define all(a)          (a).begin(), (a).end()
#define lwb             lower_bound
#define upb             upper_bound
#define vvll            vector<vector<ll> >
#define Mset(s, n)      memset(s, n, sizeof(s))
#define Sz(a)           int((a).size())
#define Max(a, b, c)    max(max((ll)(a), (ll)(b)), (ll)(c))
#define Min(a, b, c)    min(min((ll)(a), (ll)(b)), (ll)(c))
#define Unique(a)       sort(all(a)); (a).resize(unique(all(a)) - (a).begin())

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

const ll MOD = 1000000007;
const int oo = 2e9;
const ld PI = acos((ld) -1);
ll Getbit(ll x, ll k){return (x >> (k - 1)) & 1;}
ll Lcm(ll a, ll b) {return a / __gcd(a, b) * b;}
bool isPrime(ll n){for(ll i = 2; i * i <= n; i++){if(n % i == 0) return 0;} return (n > 1) ? 1 : 0;}
ll Powmod(ll n, ll k, ll p = MOD) {ll r = 1; for(; k; k /= 2, n = n * n % p){if(k & 1) r = r * n % p;} return r;}

const int N = 2e5 + 5;

ll n, m, k;
ll a[N], b[N];

void Solve(){
    cin >> n;
    ll add = 0, xr = 0;
    for(int i = 1; i <= n; i++){
        cin >> a[i];
        add += a[i];
        xr ^= a[i];
    }
    vector<ll> ans;
    if(xr * 2 > add) add *= 2, ans.pb(add);
    ll res = 0;
//    xor *= 2;
    if(add & 1) {
        add += 1, ans.pb(1);
        xr ^= 1;
    }
    for(int i = 2; i <= 63; i++){
        if(Getbit(add, i) != Getbit(xr, i - 1)){
            res += 1 << (i - 1);
            add += 1 << (i - 1);
            xr ^= 1 << (i - 1);
            if(xr * 2 == add){
                break;
            }
        }

    }
    ans.pb(res);
    cout << Sz(ans) << "\n";
    for(ll x: ans) cout << x << " "; cout << "\n";

}

int main(){
    Speed;
    int query = 1; //
    cin >> query;
    while(query--){
        Solve();
    }
}


#include <bits/stdc++.h>
#define Speed ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
using namespace std;

#define st              first
#define nd              second
#define pb              push_back
#define pf              push_front
#define all(a)          (a).begin(), (a).end()
#define lwb             lower_bound
#define upb             upper_bound
#define vvll            vector<vector<ll> >
#define Mset(s, n)      memset(s, n, sizeof(s))
#define Sz(a)           int((a).size())
#define Max(a, b, c)    max(max((ll)(a), (ll)(b)), (ll)(c))
#define Min(a, b, c)    min(min((ll)(a), (ll)(b)), (ll)(c))
#define Unique(a)       sort(all(a)); (a).resize(unique(all(a)) - (a).begin())

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

const ll MOD = 1000000007;
const int oo = 2e9;
const ld PI = acos((ld) -1);
ll Getbit(ll x, ll k){return (x >> (k - 1)) & 1;}
ll Lcm(ll a, ll b) {return a / __gcd(a, b) * b;}
bool isPrime(ll n){for(ll i = 2; i * i <= n; i++){if(n % i == 0) return 0;} return (n > 1) ? 1 : 0;}
ll Powmod(ll n, ll k, ll p = MOD) {ll r = 1; for(; k; k /= 2, n = n * n % p){if(k & 1) r = r * n % p;} return r;}

const int N = 2e5 + 5;

ll n, m, k;
ull a[N], b[N];

void Solve(){
    cin >> n;
    ull add = 0, xr = 0;
    for(int i = 1; i <= n; i++){
        cin >> a[i];
        add += a[i];
        xr ^= a[i];
    }
    cout << 2 << "\n" << xr << " " << add + xr << "\n";

}

int main(){
    Speed;
    int query = 1; //
    cin >> query;
    while(query--){
        Solve();
    }
}


#include <bits/stdc++.h>
#define Speed ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
using namespace std;

#define st              first
#define nd              second
#define pb              push_back
#define pf              push_front
#define all(a)          (a).begin(), (a).end()
#define lwb             lower_bound
#define upb             upper_bound
#define vvll            vector<vector<ll> >
#define Mset(s, n)      memset(s, n, sizeof(s))
#define Sz(a)           int((a).size())
#define Max(a, b, c)    max(max((ll)(a), (ll)(b)), (ll)(c))
#define Min(a, b, c)    min(min((ll)(a), (ll)(b)), (ll)(c))
#define Unique(a)       sort(all(a)); (a).resize(unique(all(a)) - (a).begin())

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

const ll MOD = 1000000007;
const int oo = 2e9;
const ld PI = acos((ld) -1);
ll Getbit(ll x, ll k){return (x >> (k - 1)) & 1;}
ll Lcm(ll a, ll b) {return a / __gcd(a, b) * b;}
bool isPrime(ll n){for(ll i = 2; i * i <= n; i++){if(n % i == 0) return 0;} return (n > 1) ? 1 : 0;}
ll Powmod(ll n, ll k, ll p = MOD) {ll r = 1; for(; k; k /= 2, n = n * n % p){if(k & 1) r = r * n % p;} return r;}

const int N = 2e5 + 5;

ll n, m, k;
ull a[N], b[N];

void Solve(){
    cin >> n;
    ull add = 0, xr = 0;
    for(int i = 1; i <= n; i++){
        cin >> a[i];
        add += a[i];
        xr ^= a[i];
    }
    cout << 2 << "\n" << xr << " " << s + xr << "\n";

}

int main(){
    Speed;
    int query = 1; //
    cin >> query;
    while(query--){
        Solve();
    }
}


#include <bits/stdc++.h>
#define Speed ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
using namespace std;

#define st              first
#define nd              second
#define pb              push_back
#define pf              push_front
#define all(a)          (a).begin(), (a).end()
#define lwb             lower_bound
#define upb             upper_bound
#define vvll            vector<vector<ll> >
#define Mset(s, n)      memset(s, n, sizeof(s))
#define Sz(a)           int((a).size())
#define Max(a, b, c)    max(max((ll)(a), (ll)(b)), (ll)(c))
#define Min(a, b, c)    min(min((ll)(a), (ll)(b)), (ll)(c))
#define Unique(a)       sort(all(a)); (a).resize(unique(all(a)) - (a).begin())

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

const ll MOD = 1000000007;
const int oo = 2e9;
const ld PI = acos((ld) -1);
ll Getbit(ll x, ll k){return (x >> (k - 1)) & 1;}
ll Lcm(ll a, ll b) {return a / __gcd(a, b) * b;}
bool isPrime(ll n){for(ll i = 2; i * i <= n; i++){if(n % i == 0) return 0;} return (n > 1) ? 1 : 0;}
ll Powmod(ll n, ll k, ll p = MOD) {ll r = 1; for(; k; k /= 2, n = n * n % p){if(k & 1) r = r * n % p;} return r;}

const int N = 2e5 + 5;

ll n, m, k;
ll a[N], b[N];

void Solve(){
    cin >> n;
    ll add = 0, xr = 0;
    for(int i = 1; i <= n; i++){
        cin >> a[i];
        add += a[i];
        xr ^= a[i];
    }
    vector<ll> ans;
    ll res = 0;
    for(int i = 1; i <= 64; i++){
        if(Getbit(add, i) != Getbit(xr, i - 1)){
            res += 1 << (i - 1);
            add += 1 << (i - 1);
            xr ^= 1 << (i - 1);
            if(xr * 2 == add){
                break;
            }
        }

    }
    cout << "1\n" << res << "\n";

}

int main(){
    Speed;
    int query = 1; //
    cin >> query;
    while(query--){
        Solve();
    }
}


#include <bits/stdc++.h>

#pragma GCC optimize("Ofast")

#define fi first
#define se second
#define ll long long

using namespace std;

const int N = 1e6 + 7;
const int mod = 1e9 + 7;

int n;
ll a[N];
int b[N];

void solve()
{
    cin >> n;
    for( int i = 0; i <= 100; i++ ){
        b[i] = 0;
    }
    for( int i = 1; i <= n; i++ ){
        cin >> a[i];
        for( int j = 0; j < 59; j++ ){
            if( (a[i] & (1ll << j)) ){
                b[j] ^= 1;
            }
        }
    }
    ll x = 0;
    for( int j = 59; j >= 0; j++ ){
        if( !b[j] ){
            x |= (1ll << j);
            break;
        }
    }
    if( !x )cout << "0\n";
    else{
        cout << "1\n" << x << "\n";
    }
}

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    //freopen( "input.txt" , "r" , stdin );
    //freopen( "output.txt" , "w" , stdout );

    int cghf = 1;cin >> cghf;
    while( cghf-- ){
        solve();
    }
}


#include <bits/stdc++.h>

#pragma GCC optimize("Ofast")

#define fi first
#define se second
#define ll long long

using namespace std;

const int N = 1e6 + 7;
const int mod = 1e9 + 7;

int n;
ll a[N];
int b[N];
int c[N];

void solve()
{
    cin >> n;
    for( int i = 0; i <= 100; i++ ){
        b[i] = 0;
        c[i] = 0;
    }
    ll xx = 0;
    ll yy = 0;
    for( int i = 1; i <= n; i++ ){
        cin >> a[i];
        for( int j = 0; j < 60; j++ ){
            if( (a[i] & (1ll << j)) ){
                c[j] ^= 1;
                if( b[j] > 0 ){
                    b[j]++;
                    b[j] = b[j] % 2;
                    b[j + 1] += 1;
                }else b[j] = 1;
            }
            if( b[j] > 1 ){
                b[j] = b[j] % 2;
                b[j + 1] += 1;
            }
        }
        xx += a[i];
        yy = (yy ^ a[i]);
    }
    vector < ll > v(3 , 0);
    int fg = 0;
    int last = 0;
    for( int j = 0; j < 60; j++ ){
        if( c[j] == 1 ){
            v[0] |= (1ll << j);
            b[j] += 1;
            c[j] = 0;
        }
        if( b[j] > 1 ){
            b[j] = b[j] % 2;
            b[j + 1] += 1;
        }
    }
    ll x = 0;
    ll y = 0;
    for( int i = 0; i < 50; i++ ){
        if( b[i] > 1 ){
            b[i] = b[i] % 2;
            b[i + 1] += 1;
        }
        if( b[i] == 1 )x |= (1ll << i);
    }
    v[1] = x;
    int ans = 0;
    for( int i = 0; i < 3; i++ ){
        if( v[i] != 0 )ans++;
    }
    cout << ans << "\n";
    for( int i = 0; i < 3; i++ ){
        if( v[i] == 0 )continue;
        cout << v[i] << " ";
    }
    //cout << "\n";
    for( int i = 1; i <= n; i++ ){
        y += a[i];
        x = (x ^ a[i]);
    }
    //cout << y << " " << x * 2 << "\n";
    cout << "\n";
    //exit(0);
}

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    //freopen( "input.txt" , "r" , stdin );
    //freopen( "output.txt" , "w" , stdout );

    int cghf = 1;cin >> cghf;
    while( cghf-- ){
        solve();
    }
}


#include <bits/stdc++.h>

#pragma GCC optimize("Ofast")

#define fi first
#define se second
#define ll long long

using namespace std;

const int N = 1e6 + 7;
const int mod = 1e9 + 7;

int n;
ll a[N];
int b[N];

void solve()
{
    cin >> n;
    for( int i = 0; i <= 100; i++ ){
        b[i] = 0;
    }
    for( int i = 1; i <= n; i++ ){
        cin >> a[i];
        for( int j = 0; j < 59; j++ ){
            if( (a[i] & (1ll << j)) ){
                b[j] ^= 1;
            }
        }
    }
    ll x = 0;
    for( int j = 0; j < 59; j++ ){
        if( !b[j] ){
            x |= (1ll << j);
        }
    }
    if( !x )cout << "0\n";
    else{
        cout << "1\n" << x << "\n";
    }
}

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    //freopen( "input.txt" , "r" , stdin );
    //freopen( "output.txt" , "w" , stdout );

    int cghf = 1;cin >> cghf;
    while( cghf-- ){
        solve();
    }
}


/* c */
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
#define PI acos(-1)
#define endl "\n"
#define pb push_back
#define mp make_pair
#define mod 1000000007
#define read(v, n)                                                             \
  for (ll i = 0, a; i < n; i++)                                                \
    cin >> a, v.pb(a);
#define all(v) v.begin(), v.end()
#define size(v) v.size()
#define FASTIO ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);

template <class T> ostream &operator<<(ostream &os, vector<T> v) {
  for (auto a : v) {
    os << a << " ";
  }
  return os;
}

template <class L, class R> ostream &operator<<(ostream &os, pair<L, R> p) {
  os << "{" << p.first << "," << p.second << "}";
  return os;
}

ll n, k, t;
vector<ll> v;

int main() {
  FASTIO;

  cin >> t;
  while (t--) {
    v.clear();
    cin >> n;
    ll sum = 0;
    ll xo = 0;
    for (ll i = 0; i < n; i++) {
      cin >> k;
      v.pb(k);
      sum += k;
      xo ^= k;
    }
    if (xo) {
      v.pb(xo);
    }
    sum += xo;
    v.pb(sum);
    cout << size(v) - n << endl;
    for (int i = n; i < size(v); i++)
      cout << v[i] << " ";
    cout << endl;
  }

  return 0;
}


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

typedef long long ll;
#define PI acos(-1)
#define endl "\n"
#define pb push_back
#define mp make_pair
#define mod 1000000007
#define read(v, n)                                                             \
  for (ll i = 0, a; i < n; i++)                                                \
    cin >> a, v.pb(a);
#define all(v) v.begin(), v.end()
#define size(v) v.size()
#define FASTIO ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);

template <class T> ostream &operator<<(ostream &os, vector<T> v) {
  for (auto a : v) {
    os << a << " ";
  }
  return os;
}

template <class L, class R> ostream &operator<<(ostream &os, pair<L, R> p) {
  os << "{" << p.first << "," << p.second << "}";
  return os;
}

ll n, k, t;
vector<ll> v;

int main() {
  FASTIO;

  cin >> t;
  while (t--) {
    v.clear();
    cin >> n;
    ll sum = 0;
    ll xo = 0;
    for (ll i = 0; i < n; i++) {
      cin >> k;
      v.pb(k);
      sum += k;
      xo ^= k;
    }
    if (xo) {
      v.pb(xo);
    }
    sum += xo;
    v.pb(sum);
    cout << size(v) - n << endl;
    for (int i = n; i < size(v); i++)
      cout << v[i] << " ";
    cout << endl;
  }

  return 0;
}


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

typedef long long ll;
#define PI acos(-1)
#define endl "\n"
#define pb push_back
#define mp make_pair
#define mod 1000000007
#define read(v, n)                                                             \
  for (ll i = 0, a; i < n; i++)                                                \
    cin >> a, v.pb(a);
#define all(v) v.begin(), v.end()
#define size(v) v.size()
#define FASTIO ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);

template <class T> ostream &operator<<(ostream &os, vector<T> v) {
  for (auto a : v) {
    os << a << " ";
  }
  return os;
}

template <class L, class R> ostream &operator<<(ostream &os, pair<L, R> p) {
  os << "{" << p.first << "," << p.second << "}";
  return os;
}

ll n, k, t;
vector<ll> v;

int main() {
  FASTIO;

  cin >> t;
  while (t--) {
    v.clear();
    cin >> n;
    ll sum = 0;
    ll xo = 0;
    for (ll i = 0; i < n; i++) {
      cin >> k;
      v.pb(k);
      sum += k;
      xo ^= k;
    }
    if (xo) {
      v.pb(xo);
    }
    sum += xo;
    v.pb(sum);
    cout << size(v) - n << endl;
    for (int i = n; i < size(v); i++)
      cout << v[i] << " ";
    cout << endl;
  }

  return 0;
}


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

long long a=((1LL<<42)+1), b=(1LL<<42), ap1;
long long c;
long long sumx, sum;
long long v[100005];
long long n, t;

int main()
{
    cin>>t;
    while(t--){
        cin>>n;
        sum=0, sumx=0;
        for(int i=1;i<=n;++i){
            long long x;
            cin>>x;
            sum+=x;
            sumx^=x;
        }
        if(sum&1) b=a;
        sum+=b;
        sumx^=b;
        sumx<<=1;
        c=(sumx-sum)/2;
        cout<<3<<"\n";
        cout<<b<<" "<<c<<" "<<c<<"\n";
    }
    return 0;
}


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

long long a=((1LL<<50)+1), b=(1LL<<50);
long long sumx, sum;
long long n, t;

int main()
{
    cin>>t;
    while(t--){
        cin>>n;
        sum=0, sumx=0;
        for(int i=1;i<=n;++i){
            long long x;
            cin>>x;
            sum+=x;
            sumx^=x;
        }
        long long aux=b;
        if(sum&1) aux=a;
        sum+=aux;
        sumx^=aux;
        sumx<<=1;
        long long c=(sumx-sum)/2;
        cout<<3<<"\n";
        cout<<aux<<" "<<c<<" "<<c<<"\n";
    }
    return 0;
}


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

long long a=((1LL<<42)+1), b=(1LL<<42), ap1;
long long c;
long long sumx, sum;
long long v[100005];
long long n, t;

int main()
{
    cin>>t;
    while(t--){
        cin>>n;
        sum=0, sumx=0;
        for(int i=1;i<=n;++i){
            long long x;
            cin>>x;
            sum+=x;
            sumx^=x;
        }
        long long aux=b;
        if(sum&1) aux=a;
        sum+=aux;
        sumx^=aux;
        sumx<<=1;
        c=(sumx-sum)/2;
        cout<<3<<"\n";
        cout<<aux<<" "<<c<<" "<<c<<"\n";
    }
    return 0;
}


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

long long a=((1LL<<50)+1), b=(1LL<<50);
long long sumx, sum;
long long n, t;

int main()
{
    cin>>t;
    while(t--){
        cin>>n;
        sum=0, sumx=0;
        for(int i=1;i<=n;++i){
            long long x;
            cin>>x;
            sum+=x;
            sumx^=x;
        }
        long long aux=b;
        if(sum&1) aux=a;
        sum+=aux;
        sumx^=aux;
        sumx<<=1;
        long long c=(sumx-sum)/2;
        cout<<3<<"\n";
        cout<<aux<<" "<<c<<" "<<c<<"\n";
        cout<<sum+c+c<<" "<<sumx<<"\n";
    }
    return 0;
}


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

long long a=((1LL<<42)+1), b=(1LL<<42), ap1;
long long c;
long long sumx, sum;
long long v[100005];
long long n, t;

int main()
{
    cin>>t;
    while(t--){
        cin>>n;
        sum=0, sumx=0;
        for(int i=1;i<=n;++i){
            long long x;
            cin>>x;
            sum+=x;
            sumx^=x;
        }
        if(sum&1) b=a;
        sum+=b;
        sumx^=b;
        sumx<<=1;
        cout<<sumx<<"\n";
        c=(sumx-sum)/2;
        cout<<3<<"\n";
        cout<<b<<" "<<c<<" "<<c<<"\n";
    }
    return 0;
}


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

long long a=((1LL<<50)+1), b=(1LL<<50), ap1;
long long c;
long long sumx, sum;
long long v[100005];
long long n, t;

int main()
{
    cin>>t;
    while(t--){
        cin>>n;
        sum=0, sumx=0;
        for(int i=1;i<=n;++i){
            int x;
            cin>>x;
            sum+=x;
            sumx^=x;
        }
        if(sum&1) b=a;
        sum+=b;
        sumx^=b;
        sumx<<=1;
        c=(sumx-sum)/2;
        cout<<3<<"\n";
        cout<<b<<" "<<c<<" "<<c<<"\n";
    }
    return 0;
}


#include "bits/stdc++.h"
using namespace std;
using ll = long long int;
const ll mod = 1000000007;
const ll M = 1000000000000000000ll;
#define pb push_back
inline ll add(ll a, ll b) {return ((a % mod + b % mod) % mod);}
inline ll sub(ll a, ll b) {return ((a % mod - b % mod + mod) % mod);}
inline ll mult(ll a, ll b) {return (((a % mod) * (b % mod)) % mod);}
inline ll power(ll n, ll x) {ll p = 1; while (x != 0) {if (x % 2 == 0) {n = mult(n, n); x = x / 2;} p = mult(p, n); x--;} return p;}

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    ll t;
    cin >> t;
    while (t--)
    {
        ll n, s = 0, xo = 0, i, x, k;
        ll a1 = pow(10, 16) + 1;
        ll a2 = pow(10, 16);
        cin >> n;
        for (i = 0; i < n; i++)
        {
            cin >> x;
            s += x;
            xo ^= x;
        }
        if (s == xo * 2) //OK
            cout << 0 << "\n\n";
        else if (s % 2 == 0)
        {
            k = (s + a2) * -1 + (xo ^ a2) * 2; //Ok
            cout << 3 << "\n";
            cout << a2 << " " << (k / 2) << " " << (k / 2) << "\n";
            // cout<<(a2^(k/2)^(k/2)^xo)*2<<"\n";
            // cout<<(s+k+a2)<<"\n";

        }
        else if (s % 2 == 1)
        {
            k = -1 * (s + a1) + (xo ^ a1) * 2;
            cout << 3 << "\n";                        //Ok
            cout << a1 << " " << k / 2 << " " << k / 2 << "\n";
            // cout<<(a1^(k/2)^(k/2)^xo)*2<<"\n";
            // cout<<(s+k+a1)<<"\n";
        }

    }
//    cout<<fixed;
// cout<<setprecision(0);
}


#include "bits/stdc++.h"
using namespace std;
using ll = long long int;
const ll mod = 1000000007;
const ll M = 1000000000000000000ll;
#define pb push_back
inline ll add(ll a, ll b) {return ((a % mod + b % mod) % mod);}
inline ll sub(ll a, ll b) {return ((a % mod - b % mod + mod) % mod);}
inline ll mult(ll a, ll b) {return (((a % mod) * (b % mod)) % mod);}
inline ll power(ll n, ll x) {ll p = 1; while (x != 0) {if (x % 2 == 0) {n = mult(n, n); x = x / 2;} p = mult(p, n); x--;} return p;}

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    ll t;
    cin >> t;
    while (t--)
    {
        ll n, s = 0, xo = 0, i, x, k;
        ll a1 = pow(10, 8) + 1;
        ll a2 = pow(10, 8);
        cin >> n;
        for (i = 0; i < n; i++)
        {
            cin >> x;
            s += x;
            xo ^= x;
        }
        if (s == xo * 2) //OK
            cout << 0 << "\n\n";
        else if (s % 2 == 0)
        {
            k = (s + a2) * -1 + (xo ^ a2) * 2; //Ok
            cout << 3 << "\n";
            cout << a2 << " " << (k / 2) << " " << (k / 2) << "\n";
            cout<<(a2^(k/2)^(k/2)^xo)*2<<"\n";
            cout<<(s+k+a2)<<"\n";

        }
        else if (s % 2 == 1)
        {
            k = -1 * (s + a1) + (xo ^ a1) * 2;
            cout << 3 << "\n";                        //Ok
            cout << a1 << " " << k / 2 << " " << k / 2 << "\n";
            cout<<(a1^(k/2)^(k/2)^xo)*2<<"\n";
            cout<<(s+k+a1)<<"\n";
        }

    }
//    cout<<fixed;
// cout<<setprecision(0);
}


#include "bits/stdc++.h"
using namespace std;
using ll = long long int;
const ll mod = 1000000007;
const ll M = 1000000000000000000ll;
#define pb push_back
inline ll add(ll a, ll b) {return ((a % mod + b % mod) % mod);}
inline ll sub(ll a, ll b) {return ((a % mod - b % mod + mod) % mod);}
inline ll mult(ll a, ll b) {return (((a % mod) * (b % mod)) % mod);}
inline ll power(ll n, ll x) {ll p = 1; while (x != 0) {if (x % 2 == 0) {n = mult(n, n); x = x / 2;} p = mult(p, n); x--;} return p;}

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    ll t;
    cin >> t;
    while (t--)
    {
        ll n, s = 0, xo = 0, i, x, k;
        ll a1 = pow(10, 14) + 1;
        ll a2 = pow(10, 14);
        cin >> n;
        for (i = 0; i < n; i++)
        {
            cin >> x;
            s += x;
            xo ^= x;
        }
        if (s == xo * 2) //OK
            cout << 0 << "\n\n";
        else if (s % 2 == 0)
        {
            k = (s + a2) * -1 + (xo ^ a2) * 2; //Ok
            cout << 3 << "\n";
            cout << a2 << " " << (k / 2) << " " << (k / 2) << "\n";
            // cout<<(a2^(k/2)^(k/2)^xo)*2<<"\n";
            // cout<<(s+k+a2)<<"\n";

        }
        else if (s % 2 == 1)
        {
            k = -1 * (s + a1) + (xo ^ a1) * 2;
            cout << 3 << "\n";                        //Ok
            cout << a1 << " " << k / 2 << " " << k / 2 << "\n";
            // cout<<(a1^(k/2)^(k/2)^xo)*2<<"\n";
            // cout<<(s+k+a1)<<"\n";
        }

    }
//    cout<<fixed;
// cout<<setprecision(0);
}


#include "bits/stdc++.h"
using namespace std;
using ll = long long int;
const ll mod = 1000000007;
const ll M = 1000000000000000000ll;
#define pb push_back
inline ll add(ll a, ll b) {return ((a % mod + b % mod) % mod);}
inline ll sub(ll a, ll b) {return ((a % mod - b % mod + mod) % mod);}
inline ll mult(ll a, ll b) {return (((a % mod) * (b % mod)) % mod);}
inline ll power(ll n, ll x) {ll p = 1; while (x != 0) {if (x % 2 == 0) {n = mult(n, n); x = x / 2;} p = mult(p, n); x--;} return p;}

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    ll t;
    cin >> t;
    while (t--)
    {
        ll n, s = 0, xo = 0, i, x, k;
        ll a1 = pow(10, 16) + 1;
        ll a2 = pow(10, 16);
        cin >> n;
        for (i = 0; i < n; i++)
        {
            cin >> x;
            s += x;
            xo ^= x;
        }
        if (s == xo * 2) //OK
            cout << 0 << "\n\n";
        else if (s % 2 == 0)
        {
            k = (s + a2) * -1 + (xo ^ a2) * 2; //Ok
            cout << 3 << "\n";
            cout << a2 << " " << (k / 2) << " " << (k / 2) << "\n";

        }
        else if (s % 2 == 1)
        {
            k = -1 * (s + a1) + (xo ^ a1) * 2;
            cout << 3 << "\n";                        //Ok
            cout << a1 << " " << k / 2 << " " << k / 2 << "\n";
        }

    }
//    cout<<fixed;
// cout<<setprecision(0);
}


#include "bits/stdc++.h"
using namespace std;
using ll = long long int;
const ll mod = 1000000007;
const ll M = 1000000000000000000ll;
#define pb push_back
inline ll add(ll a, ll b) {return ((a % mod + b % mod) % mod);}
inline ll sub(ll a, ll b) {return ((a % mod - b % mod + mod) % mod);}
inline ll mult(ll a, ll b) {return (((a % mod) * (b % mod)) % mod);}
inline ll power(ll n, ll x) {ll p = 1; while (x != 0) {if (x % 2 == 0) {n = mult(n, n); x = x / 2;} p = mult(p, n); x--;} return p;}

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    ll t;
    cin >> t;
    while (t--)
    {
        ll n, s = 0, xo = 0, i, x, k;
        ll a1 = pow(10, 15) + 1;
        ll a2 = pow(10, 15);
        cin >> n;
        for (i = 0; i < n; i++)
        {
            cin >> x;
            s += x;
            xo ^= x;
        }
        if (s == xo * 2) //OK
            cout << 0 << "\n\n";
        else if (s % 2 == 0)
        {
            k = (s + a2) * -1 + (xo ^ a2) * 2; //Ok
            cout << 3 << "\n";
            cout << a2 << " " << (k / 2) << " " << (k / 2) << "\n";
            // cout<<(a2^(k/2)^(k/2)^xo)*2<<"\n";
            // cout<<(s+k+a2)<<"\n";

        }
        else if (s % 2 == 1)
        {
            k = -1 * (s + a1) + (xo ^ a1) * 2;
            cout << 3 << "\n";                        //Ok
            cout << a1 << " " << k / 2 << " " << k / 2 << "\n";
            // cout<<(a1^(k/2)^(k/2)^xo)*2<<"\n";
            // cout<<(s+k+a1)<<"\n";
        }

    }
//    cout<<fixed;
// cout<<setprecision(0);
}


#include "bits/stdc++.h"
using namespace std;
using ll = long long int;
const ll mod = 1000000007;
const ll M = 1000000000000000000ll;
#define pb push_back
inline ll add(ll a, ll b) {return ((a % mod + b % mod) % mod);}
inline ll sub(ll a, ll b) {return ((a % mod - b % mod + mod) % mod);}
inline ll mult(ll a, ll b) {return (((a % mod) * (b % mod)) % mod);}
inline ll power(ll n, ll x) {ll p = 1; while (x != 0) {if (x % 2 == 0) {n = mult(n, n); x = x / 2;} p = mult(p, n); x--;} return p;}

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    ll t;
    cin >> t;
    while (t--)
    {
        ll n, s = 0, xo = 0, i, x, k;
        ll a1 = pow(10, 10) + 1;
        ll a2 = pow(10, 10);
        cin >> n;
        for (i = 0; i < n; i++)
        {
            cin >> x;
            s += x;
            xo ^= x;
        }
        cout<<2<<"\n";
        cout<<xo<<" "<<(s+xo)<<"\n";
    }
//    cout<<fixed;
// cout<<setprecision(0);
}


#include "bits/stdc++.h"
using namespace std;
using ll = long long int;
const ll mod = 1000000007;
const ll M = 1000000000000000000ll;
#define pb push_back
inline ll add(ll a, ll b) {return ((a % mod + b % mod) % mod);}
inline ll sub(ll a, ll b) {return ((a % mod - b % mod + mod) % mod);}
inline ll mult(ll a, ll b) {return (((a % mod) * (b % mod)) % mod);}
inline ll power(ll n, ll x) {ll p = 1; while (x != 0) {if (x % 2 == 0) {n = mult(n, n); x = x / 2;} p = mult(p, n); x--;} return p;}

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    ll t;
    cin >> t;
    while (t--)
    {
        ll n, s = 0, xo = 0, i, x, k;
        ll a1 = pow(10, 8) + 1;
        ll a2 = pow(10, 8);
        cin >> n;
        for (i = 0; i < n; i++)
        {
            cin >> x;
            s += x;
            xo ^= x;
        }
        if (s == xo * 2) //OK
            cout << 0 << "\n\n";
        else if (s % 2 == 0)
        {
            k = (s + a2) * -1 + (xo ^ a2) * 2; //Ok
            cout << 3 << "\n";
            cout << a2 << " " << (k / 2) << " " << (k / 2) << "\n";
            // cout<<(a2^(k/2)^(k/2)^xo)*2<<"\n";
            // cout<<(s+k+a2)<<"\n";

        }
        else if (s % 2 == 1)
        {
            k = -1 * (s + a1) + (xo ^ a1) * 2;
            cout << 3 << "\n";                        //Ok
            cout << a1 << " " << k / 2 << " " << k / 2 << "\n";
            // cout<<(a1^(k/2)^(k/2)^xo)*2<<"\n";
            // cout<<(s+k+a1)<<"\n";
        }

    }
//    cout<<fixed;
// cout<<setprecision(0);
}


#include "bits/stdc++.h"
using namespace std;
using ll = long long int;
const ll mod = 1000000007;
const ll M = 1000000000000000000ll;
#define pb push_back
inline ll add(ll a, ll b) {return ((a % mod + b % mod) % mod);}
inline ll sub(ll a, ll b) {return ((a % mod - b % mod + mod) % mod);}
inline ll mult(ll a, ll b) {return (((a % mod) * (b % mod)) % mod);}
inline ll power(ll n, ll x) {ll p = 1; while (x != 0) {if (x % 2 == 0) {n = mult(n, n); x = x / 2;} p = mult(p, n); x--;} return p;}

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    ll t;
    cin >> t;
    while (t--)
    {
        ll n, s = 0, xo = 0, i, x, k;
        ll a1 = pow(10, 10) + 1;
        ll a2 = pow(10, 10);
        cin >> n;
        for (i = 0; i < n; i++)
        {
            cin >> x;
            s += x;
            xo ^= x;
        }
        if (s == xo * 2) //OK
            cout << 0 << "\n\n";
        else if (s % 2 == 0)
        {
            k = (s + a2) * -1 + (xo ^ a2) * 2; //Ok
            cout << 3 << "\n";
            cout << a2 << " " << (k / 2) << " " << (k / 2) << "\n";

        }
        else if (s % 2 == 1)
        {
            k = -1 * (s + a1) + (xo ^ a1) * 2;
            cout << 3 << "\n";                        //Ok
            cout << a1 << " " << k / 2 << " " << k / 2 << "\n";
        }

    }
//    cout<<fixed;
// cout<<setprecision(0);
}


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

#define MAX 10000
#define INF 1e100
#define isset(n,i) ((n>>i)&1LL)

#define REP(i,n) for(int i=0;i<(n);i++)
#define FOR(i,a,b) for(int i=(a);i<=(b);i++)
#define sor(A) sort(A.begin(),A.end())
#define rsor(A) sort(A.rbegin(),A.rend())
#define all(A) A.begin(),A.end()

typedef long long ll;
#define VI  vector<int>
#define VLL  vector<long long>
#define VVI vector<vector<int>>
#define VS  vector<string>
#define VVS vector<vector<string>>

#define ASSERT(X) {if (!(X)) {printf("\n assertion failed at line %d\n",__LINE__);exit(0);}}

//BEGINTEMPLATE_BY_ACRUSH_TOPCODER

#define SIZE(X) ((int)(X.size()))//NOTES:SIZE(

#define LENGTH(X) ((int)(X.length()))//NOTES:LENGTH(

#define two(X) (1<<(X))//NOTES:two(

#define twoL(X) (((unsigned long long)(1))<<(X))//NOTES:twoL(

#define contain(S,X) (((S)&two(X))!=0)//NOTES:contain(

#define containL(S,X) (((S)&twoL(X))!=0)//NOTES:containL(

const double pi=acos(-1.0);//NOTES:pi

const double eps=1e-11;//NOTES:eps

template<class T> inline void checkmin(T &a,T b){if(b<a) a=b;}//NOTES:checkmin(

template<class T> inline void checkmax(T &a,T b){if(b>a) a=b;}//NOTES:checkmax(

template<class T> inline T sqr(T x){return x*x;}//NOTES:sqr

int lsb(unsigned int v){
	int r;           // result goes here
	static const int MultiplyDeBruijnBitPosition[32] =
	{
	  0, 1, 28, 2, 29, 14, 24, 3, 30, 22, 20, 15, 25, 17, 4, 8,
	  31, 27, 13, 23, 21, 19, 16, 7, 26, 12, 18, 6, 11, 5, 10, 9
	};
	r = MultiplyDeBruijnBitPosition[((uint32_t)((v & -v) * 0x077CB531U)) >> 27];
	return r+1;
}

template<class T> inline int msb(T n){return (n==0)?0:(1+msb(n>>1));}//NOTES:msb(
template<class T> inline T getbit(T n,int pos){return ((n&(1<<pos))?1:0);}//NOTES:getbit(
template<class T> inline int countbit(T n){return (n==0)?0:(1+countbit(n&(n-1)));}//NOTES:countbit(

//Numberic Functions

template<class T> inline T gcd(T a,T b)//NOTES:gcd(
  {if(a<0)return gcd(-a,b);if(b<0)return gcd(a,-b);return (b==0)?a:gcd(b,a%b);}

bool isequal(vector<int> a,vector<int> b){
	REP(i,a.size()) if(a[i]!=b[i]) return false;
	return true;
}

template<class T>
bool allequal(vector<T> a){
	sor(a);
	return a[0]==a[a.size()-1];
}

template<class T>
void printarray(vector<T> a){
	REP(i,a.size())cout << a[i] << " ";
	cout<< endl;
}

template<class T>
void printsubarray(vector<T> a,int start ,int end){
	if(start<0 or end>a.size()-1) cout << "Out of bounds" << endl;
	for(int i=start;i<=end;i++)cout << a[i] << " ";
	cout<< endl;
}

bool isprime(int n){
	if(n<2) return false;
	if(n==2) return true;
	for(int i=2;i*i<=n;i++){
		if(n%i==0) return false;
	}
	return true;
}

// Error checking

#define error(args...) { vector<string> _v; split(#args, ',', _v); err(_v.begin(), args); }

void split(const string& s, char c, vector<string>& result) {
    stringstream ss(s);
    string x;
    while (getline(ss, x, c))
        result.push_back(x);
}

void err(vector<string>::iterator it) {}
template<typename T, typename... Args>
void err(vector<string>::iterator it, T a, Args... args) {
    cerr << it -> substr((*it)[0] == ' ', it -> length()) << " = " << a << '\n';
    err(++it, args...);
}

/*
 error(a, b, c)
std. error output:
 a = 4
 b = 8
 c = 9
*/

//ENDTEMPLATE_BY_ACRUSH_TOPCODER

void readarray(vector<ll>& a,int size){
	ll tmp;
	a.clear();
	REP(i,size){
		cin>>tmp;
		a.push_back(tmp);
	}
}

bool invalid(int n,int k){
	int nbits = countbit(n);
	if(k<nbits or k>n) return false;
	return true;
}
void solvecase(){
	int n;
	ll xr=0,sum=0,t=0,pad=0;
	vector<long long> a;
	cin >> n;
	readarray(a,n);
	for(ll t:a){
		sum+=t;
		xr ^=t;
	}
	if(2*xr<sum){
		pad = (1LL<<(1+msb(sum)));
		if(sum%2LL)pad--;
	}
	xr^=pad;
	sum+=pad;
	t = (2*xr-sum)>>1;
	error(sum,xr,pad,t);
	cout << "3\n" << t << " " << t << " " << pad << endl;
}

int main() {
  int cases=1;
  cin >> cases;
  while(cases--){
	  solvecase();
  }
  return 0;
}


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

#define MAX 10000
#define INF 1e100
#define isset(n,i) ((n>>i)&1LL)

#define REP(i,n) for(int i=0;i<(n);i++)
#define FOR(i,a,b) for(int i=(a);i<=(b);i++)
#define sor(A) sort(A.begin(),A.end())
#define rsor(A) sort(A.rbegin(),A.rend())
#define all(A) A.begin(),A.end()

typedef long long ll;
#define VI  vector<int>
#define VLL  vector<long long>
#define VVI vector<vector<int>>
#define VS  vector<string>
#define VVS vector<vector<string>>

#define ASSERT(X) {if (!(X)) {printf("\n assertion failed at line %d\n",__LINE__);exit(0);}}

//BEGINTEMPLATE_BY_ACRUSH_TOPCODER

#define SIZE(X) ((int)(X.size()))//NOTES:SIZE(

#define LENGTH(X) ((int)(X.length()))//NOTES:LENGTH(

#define two(X) (1<<(X))//NOTES:two(

#define twoL(X) (((unsigned long long)(1))<<(X))//NOTES:twoL(

#define contain(S,X) (((S)&two(X))!=0)//NOTES:contain(

#define containL(S,X) (((S)&twoL(X))!=0)//NOTES:containL(

const double pi=acos(-1.0);//NOTES:pi

const double eps=1e-11;//NOTES:eps

template<class T> inline void checkmin(T &a,T b){if(b<a) a=b;}//NOTES:checkmin(

template<class T> inline void checkmax(T &a,T b){if(b>a) a=b;}//NOTES:checkmax(

template<class T> inline T sqr(T x){return x*x;}//NOTES:sqr

int lsb(unsigned int v){
	int r;           // result goes here
	static const int MultiplyDeBruijnBitPosition[32] =
	{
	  0, 1, 28, 2, 29, 14, 24, 3, 30, 22, 20, 15, 25, 17, 4, 8,
	  31, 27, 13, 23, 21, 19, 16, 7, 26, 12, 18, 6, 11, 5, 10, 9
	};
	r = MultiplyDeBruijnBitPosition[((uint32_t)((v & -v) * 0x077CB531U)) >> 27];
	return r+1;
}

template<class T> inline int msb(T n){return (n==0)?0:(1+msb(n>>1));}//NOTES:msb(
template<class T> inline T getbit(T n,int pos){return ((n&(1<<pos))?1:0);}//NOTES:getbit(
template<class T> inline int countbit(T n){return (n==0)?0:(1+countbit(n&(n-1)));}//NOTES:countbit(

//Numberic Functions

template<class T> inline T gcd(T a,T b)//NOTES:gcd(
  {if(a<0)return gcd(-a,b);if(b<0)return gcd(a,-b);return (b==0)?a:gcd(b,a%b);}

bool isequal(vector<int> a,vector<int> b){
	REP(i,a.size()) if(a[i]!=b[i]) return false;
	return true;
}

template<class T>
bool allequal(vector<T> a){
	sor(a);
	return a[0]==a[a.size()-1];
}

template<class T>
void printarray(vector<T> a){
	REP(i,a.size())cout << a[i] << " ";
	cout<< endl;
}

template<class T>
void printsubarray(vector<T> a,int start ,int end){
	if(start<0 or end>a.size()-1) cout << "Out of bounds" << endl;
	for(int i=start;i<=end;i++)cout << a[i] << " ";
	cout<< endl;
}

bool isprime(int n){
	if(n<2) return false;
	if(n==2) return true;
	for(int i=2;i*i<=n;i++){
		if(n%i==0) return false;
	}
	return true;
}

// Error checking

#define error(args...) { vector<string> _v; split(#args, ',', _v); err(_v.begin(), args); }

void split(const string& s, char c, vector<string>& result) {
    stringstream ss(s);
    string x;
    while (getline(ss, x, c))
        result.push_back(x);
}

void err(vector<string>::iterator it) {}
template<typename T, typename... Args>
void err(vector<string>::iterator it, T a, Args... args) {
    cerr << it -> substr((*it)[0] == ' ', it -> length()) << " = " << a << '\n';
    err(++it, args...);
}

/*
 error(a, b, c)
std. error output:
 a = 4
 b = 8
 c = 9
*/

//ENDTEMPLATE_BY_ACRUSH_TOPCODER

void readarray(vector<ll>& a,int size){
	ll tmp;
	a.clear();
	REP(i,size){
		cin>>tmp;
		a.push_back(tmp);
	}
}

bool invalid(int n,int k){
	int nbits = countbit(n);
	if(k<nbits or k>n) return false;
	return true;
}
void solvecase(){
	int n;
	ll xr=0,sum=0,t=0,pad=0;
	vector<long long> a;
	cin >> n;
	readarray(a,n);
	for(ll t:a){
		sum+=t;
		xr ^=t;
	}
	if(2*xr<sum){
		pad = (1LL<<msb(sum));
		if(sum%2LL)pad--;
	}
	xr^=pad;
	sum+=pad;
	t = (2*xr-sum)>>1;
	error(sum,xr,pad,t);
	cout << "3\n" << t << " " << t << " " << pad << endl;
}

int main() {
  int cases=1;
  cin >> cases;
  while(cases--){
	  solvecase();
  }
  return 0;
}


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

#define MAX 10000
#define INF 1e100
#define isset(n,i) ((n>>i)&1LL)

#define REP(i,n) for(int i=0;i<(n);i++)
#define FOR(i,a,b) for(int i=(a);i<=(b);i++)
#define sor(A) sort(A.begin(),A.end())
#define rsor(A) sort(A.rbegin(),A.rend())
#define all(A) A.begin(),A.end()

typedef long long ll;
#define VI  vector<int>
#define VLL  vector<long long>
#define VVI vector<vector<int>>
#define VS  vector<string>
#define VVS vector<vector<string>>

#define ASSERT(X) {if (!(X)) {printf("\n assertion failed at line %d\n",__LINE__);exit(0);}}

//BEGINTEMPLATE_BY_ACRUSH_TOPCODER

#define SIZE(X) ((int)(X.size()))//NOTES:SIZE(

#define LENGTH(X) ((int)(X.length()))//NOTES:LENGTH(

#define two(X) (1<<(X))//NOTES:two(

#define twoL(X) (((unsigned long long)(1))<<(X))//NOTES:twoL(

#define contain(S,X) (((S)&two(X))!=0)//NOTES:contain(

#define containL(S,X) (((S)&twoL(X))!=0)//NOTES:containL(

const double pi=acos(-1.0);//NOTES:pi

const double eps=1e-11;//NOTES:eps

template<class T> inline void checkmin(T &a,T b){if(b<a) a=b;}//NOTES:checkmin(

template<class T> inline void checkmax(T &a,T b){if(b>a) a=b;}//NOTES:checkmax(

template<class T> inline T sqr(T x){return x*x;}//NOTES:sqr

int lsb(unsigned int v){
	int r;           // result goes here
	static const int MultiplyDeBruijnBitPosition[32] =
	{
	  0, 1, 28, 2, 29, 14, 24, 3, 30, 22, 20, 15, 25, 17, 4, 8,
	  31, 27, 13, 23, 21, 19, 16, 7, 26, 12, 18, 6, 11, 5, 10, 9
	};
	r = MultiplyDeBruijnBitPosition[((uint32_t)((v & -v) * 0x077CB531U)) >> 27];
	return r+1;
}

template<class T> inline int msb(T n){return (n==0)?0:(1+msb(n>>1));}//NOTES:msb(
template<class T> inline T getbit(T n,int pos){return ((n&(1<<pos))?1:0);}//NOTES:getbit(
template<class T> inline int countbit(T n){return (n==0)?0:(1+countbit(n&(n-1)));}//NOTES:countbit(

//Numberic Functions

template<class T> inline T gcd(T a,T b)//NOTES:gcd(
  {if(a<0)return gcd(-a,b);if(b<0)return gcd(a,-b);return (b==0)?a:gcd(b,a%b);}

bool isequal(vector<int> a,vector<int> b){
	REP(i,a.size()) if(a[i]!=b[i]) return false;
	return true;
}

template<class T>
bool allequal(vector<T> a){
	sor(a);
	return a[0]==a[a.size()-1];
}

template<class T>
void printarray(vector<T> a){
	REP(i,a.size())cout << a[i] << " ";
	cout<< endl;
}

template<class T>
void printsubarray(vector<T> a,int start ,int end){
	if(start<0 or end>a.size()-1) cout << "Out of bounds" << endl;
	for(int i=start;i<=end;i++)cout << a[i] << " ";
	cout<< endl;
}

bool isprime(int n){
	if(n<2) return false;
	if(n==2) return true;
	for(int i=2;i*i<=n;i++){
		if(n%i==0) return false;
	}
	return true;
}

// Error checking

#define error(args...) { vector<string> _v; split(#args, ',', _v); err(_v.begin(), args); }

void split(const string& s, char c, vector<string>& result) {
    stringstream ss(s);
    string x;
    while (getline(ss, x, c))
        result.push_back(x);
}

void err(vector<string>::iterator it) {}
template<typename T, typename... Args>
void err(vector<string>::iterator it, T a, Args... args) {
    cerr << it -> substr((*it)[0] == ' ', it -> length()) << " = " << a << '\n';
    err(++it, args...);
}

/*
 error(a, b, c)
std. error output:
 a = 4
 b = 8
 c = 9
*/

//ENDTEMPLATE_BY_ACRUSH_TOPCODER

void readarray(vector<ll>& a,int size){
	ll tmp;
	a.clear();
	REP(i,size){
		cin>>tmp;
		a.push_back(tmp);
	}
}

bool invalid(int n,int k){
	int nbits = countbit(n);
	if(k<nbits or k>n) return false;
	return true;
}
void solvecase(){
	int n;
	ll xr=0,sum=0,t=0,pad=0;
	vector<long long> a;
	cin >> n;
	readarray(a,n);
	for(ll t:a){
		sum+=t;
		xr ^=t;
	}
	if(2*xr<sum or (sum==1 and xr==1)){
		pad = (1LL<<(1+msb(sum)));
		if(sum%2LL)pad--;
	}
	xr^=pad;
	sum+=pad;
	t = (2*xr-sum)>>1;
	error(sum,xr,pad,t);
	cout << "3\n" << t << " " << t << " " << pad << endl;
}

int main() {
  int cases=1;
  cin >> cases;
  while(cases--){
	  solvecase();
  }
  return 0;
}


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

#define MAX 10000
#define INF 1e100
#define isset(n,i) ((n>>i)&1LL)

#define REP(i,n) for(int i=0;i<(n);i++)
#define FOR(i,a,b) for(int i=(a);i<=(b);i++)
#define sor(A) sort(A.begin(),A.end())
#define rsor(A) sort(A.rbegin(),A.rend())
#define all(A) A.begin(),A.end()

typedef long long ll;
#define VI  vector<int>
#define VLL  vector<long long>
#define VVI vector<vector<int>>
#define VS  vector<string>
#define VVS vector<vector<string>>

#define ASSERT(X) {if (!(X)) {printf("\n assertion failed at line %d\n",__LINE__);exit(0);}}

//BEGINTEMPLATE_BY_ACRUSH_TOPCODER

#define SIZE(X) ((int)(X.size()))//NOTES:SIZE(

#define LENGTH(X) ((int)(X.length()))//NOTES:LENGTH(

#define two(X) (1<<(X))//NOTES:two(

#define twoL(X) (((unsigned long long)(1))<<(X))//NOTES:twoL(

#define contain(S,X) (((S)&two(X))!=0)//NOTES:contain(

#define containL(S,X) (((S)&twoL(X))!=0)//NOTES:containL(

const double pi=acos(-1.0);//NOTES:pi

const double eps=1e-11;//NOTES:eps

template<class T> inline void checkmin(T &a,T b){if(b<a) a=b;}//NOTES:checkmin(

template<class T> inline void checkmax(T &a,T b){if(b>a) a=b;}//NOTES:checkmax(

template<class T> inline T sqr(T x){return x*x;}//NOTES:sqr

int lsb(unsigned int v){
	int r;           // result goes here
	static const int MultiplyDeBruijnBitPosition[32] =
	{
	  0, 1, 28, 2, 29, 14, 24, 3, 30, 22, 20, 15, 25, 17, 4, 8,
	  31, 27, 13, 23, 21, 19, 16, 7, 26, 12, 18, 6, 11, 5, 10, 9
	};
	r = MultiplyDeBruijnBitPosition[((uint32_t)((v & -v) * 0x077CB531U)) >> 27];
	return r+1;
}

template<class T> inline int msb(T n){return (n==0)?0:(1+msb(n>>1));}//NOTES:msb(
template<class T> inline T getbit(T n,int pos){return ((n&(1<<pos))?1:0);}//NOTES:getbit(
template<class T> inline int countbit(T n){return (n==0)?0:(1+countbit(n&(n-1)));}//NOTES:countbit(

//Numberic Functions

template<class T> inline T gcd(T a,T b)//NOTES:gcd(
  {if(a<0)return gcd(-a,b);if(b<0)return gcd(a,-b);return (b==0)?a:gcd(b,a%b);}

bool isequal(vector<int> a,vector<int> b){
	REP(i,a.size()) if(a[i]!=b[i]) return false;
	return true;
}

template<class T>
bool allequal(vector<T> a){
	sor(a);
	return a[0]==a[a.size()-1];
}

template<class T>
void printarray(vector<T> a){
	REP(i,a.size())cout << a[i] << " ";
	cout<< endl;
}

template<class T>
void printsubarray(vector<T> a,int start ,int end){
	if(start<0 or end>a.size()-1) cout << "Out of bounds" << endl;
	for(int i=start;i<=end;i++)cout << a[i] << " ";
	cout<< endl;
}

bool isprime(int n){
	if(n<2) return false;
	if(n==2) return true;
	for(int i=2;i*i<=n;i++){
		if(n%i==0) return false;
	}
	return true;
}

// Error checking

#define error(args...) { vector<string> _v; split(#args, ',', _v); err(_v.begin(), args); }

void split(const string& s, char c, vector<string>& result) {
    stringstream ss(s);
    string x;
    while (getline(ss, x, c))
        result.push_back(x);
}

void err(vector<string>::iterator it) {}
template<typename T, typename... Args>
void err(vector<string>::iterator it, T a, Args... args) {
    cerr << it -> substr((*it)[0] == ' ', it -> length()) << " = " << a << '\n';
    err(++it, args...);
}

/*
 error(a, b, c)
std. error output:
 a = 4
 b = 8
 c = 9
*/

//ENDTEMPLATE_BY_ACRUSH_TOPCODER

void readarray(vector<int>& a,int size){
	int tmp;
	a.clear();
	REP(i,size){
		cin>>tmp;
		a.push_back(tmp);
	}
}

bool invalid(int n,int k){
	int nbits = countbit(n);
	if(k<nbits or k>n) return false;
	return true;
}
void solvecase(){
	int n;
	ll xr,sum,t,pad=0;
	VI a;
	cin >> n;
	readarray(a,n);
	for(int t:a){
		sum+=t;
		xr ^=t;
	}
	if(2*xr<sum){
		pad = (1LL<<msb(sum));
		if(sum%2LL)pad--;
	}
	xr^=pad;
	sum+=pad;
	t = (2*xr-sum)>>1;
	error(sum,xr,pad,t);
	cout << "3\n" << t << " " << t << " " << pad << endl;
}

int main() {
  int cases=1;
  cin >> cases;
  while(cases--){
	  solvecase();
  }
  return 0;
}


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

#define MAX 10000
#define INF 1e100
#define isset(n,i) ((n>>i)&1LL)

#define REP(i,n) for(int i=0;i<(n);i++)
#define FOR(i,a,b) for(int i=(a);i<=(b);i++)
#define sor(A) sort(A.begin(),A.end())
#define rsor(A) sort(A.rbegin(),A.rend())
#define all(A) A.begin(),A.end()

typedef long long ll;
#define VI  vector<int>
#define VLL  vector<long long>
#define VVI vector<vector<int>>
#define VS  vector<string>
#define VVS vector<vector<string>>

#define ASSERT(X) {if (!(X)) {printf("\n assertion failed at line %d\n",__LINE__);exit(0);}}

//BEGINTEMPLATE_BY_ACRUSH_TOPCODER

#define SIZE(X) ((int)(X.size()))//NOTES:SIZE(

#define LENGTH(X) ((int)(X.length()))//NOTES:LENGTH(

#define two(X) (1<<(X))//NOTES:two(

#define twoL(X) (((unsigned long long)(1))<<(X))//NOTES:twoL(

#define contain(S,X) (((S)&two(X))!=0)//NOTES:contain(

#define containL(S,X) (((S)&twoL(X))!=0)//NOTES:containL(

const double pi=acos(-1.0);//NOTES:pi

const double eps=1e-11;//NOTES:eps

template<class T> inline void checkmin(T &a,T b){if(b<a) a=b;}//NOTES:checkmin(

template<class T> inline void checkmax(T &a,T b){if(b>a) a=b;}//NOTES:checkmax(

template<class T> inline T sqr(T x){return x*x;}//NOTES:sqr

int lsb(unsigned int v){
	int r;           // result goes here
	static const int MultiplyDeBruijnBitPosition[32] =
	{
	  0, 1, 28, 2, 29, 14, 24, 3, 30, 22, 20, 15, 25, 17, 4, 8,
	  31, 27, 13, 23, 21, 19, 16, 7, 26, 12, 18, 6, 11, 5, 10, 9
	};
	r = MultiplyDeBruijnBitPosition[((uint32_t)((v & -v) * 0x077CB531U)) >> 27];
	return r+1;
}

template<class T> inline int msb(T n){return (n==0)?0:(1+msb(n>>1));}//NOTES:msb(
template<class T> inline T getbit(T n,int pos){return ((n&(1<<pos))?1:0);}//NOTES:getbit(
template<class T> inline int countbit(T n){return (n==0)?0:(1+countbit(n&(n-1)));}//NOTES:countbit(

//Numberic Functions

template<class T> inline T gcd(T a,T b)//NOTES:gcd(
  {if(a<0)return gcd(-a,b);if(b<0)return gcd(a,-b);return (b==0)?a:gcd(b,a%b);}

bool isequal(vector<int> a,vector<int> b){
	REP(i,a.size()) if(a[i]!=b[i]) return false;
	return true;
}

template<class T>
bool allequal(vector<T> a){
	sor(a);
	return a[0]==a[a.size()-1];
}

template<class T>
void printarray(vector<T> a){
	REP(i,a.size())cout << a[i] << " ";
	cout<< endl;
}

template<class T>
void printsubarray(vector<T> a,int start ,int end){
	if(start<0 or end>a.size()-1) cout << "Out of bounds" << endl;
	for(int i=start;i<=end;i++)cout << a[i] << " ";
	cout<< endl;
}

bool isprime(int n){
	if(n<2) return false;
	if(n==2) return true;
	for(int i=2;i*i<=n;i++){
		if(n%i==0) return false;
	}
	return true;
}

// Error checking

#define error(args...) { vector<string> _v; split(#args, ',', _v); err(_v.begin(), args); }

void split(const string& s, char c, vector<string>& result) {
    stringstream ss(s);
    string x;
    while (getline(ss, x, c))
        result.push_back(x);
}

void err(vector<string>::iterator it) {}
template<typename T, typename... Args>
void err(vector<string>::iterator it, T a, Args... args) {
    cerr << it -> substr((*it)[0] == ' ', it -> length()) << " = " << a << '\n';
    err(++it, args...);
}

/*
 error(a, b, c)
std. error output:
 a = 4
 b = 8
 c = 9
*/

//ENDTEMPLATE_BY_ACRUSH_TOPCODER

void readarray(vector<ll>& a,int size){
	ll tmp;
	a.clear();
	REP(i,size){
		cin>>tmp;
		a.push_back(tmp);
	}
}

bool invalid(int n,int k){
	int nbits = countbit(n);
	if(k<nbits or k>n) return false;
	return true;
}
void solvecase(){
	int n;
	ll xr=0,sum=0,t=0,pad=0;
	vector<long long> a;
	cin >> n;
	readarray(a,n);
	for(ll t:a){
		sum+=t;
		xr ^=t;
	}
	pad = (1LL<<(2+msb(sum)));
	if(sum%2LL)pad--;

	xr^=pad;
	sum+=pad;
	t = (2*xr-sum)>>1;
	error(sum,xr,pad,t);
	cout << "3\n" << t << " " << t << " " << pad << endl;
}

int main() {
  int cases=1;
  cin >> cases;
  while(cases--){
	  solvecase();
  }
  return 0;
}


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

#define MAX 10000
#define INF 1e100
#define isset(n,i) ((n>>i)&1LL)

#define REP(i,n) for(int i=0;i<(n);i++)
#define FOR(i,a,b) for(int i=(a);i<=(b);i++)
#define sor(A) sort(A.begin(),A.end())
#define rsor(A) sort(A.rbegin(),A.rend())
#define all(A) A.begin(),A.end()

typedef long long ll;
#define VI  vector<int>
#define VLL  vector<long long>
#define VVI vector<vector<int>>
#define VS  vector<string>
#define VVS vector<vector<string>>

#define ASSERT(X) {if (!(X)) {printf("\n assertion failed at line %d\n",__LINE__);exit(0);}}

//BEGINTEMPLATE_BY_ACRUSH_TOPCODER

#define SIZE(X) ((int)(X.size()))//NOTES:SIZE(

#define LENGTH(X) ((int)(X.length()))//NOTES:LENGTH(

#define two(X) (1<<(X))//NOTES:two(

#define twoL(X) (((unsigned long long)(1))<<(X))//NOTES:twoL(

#define contain(S,X) (((S)&two(X))!=0)//NOTES:contain(

#define containL(S,X) (((S)&twoL(X))!=0)//NOTES:containL(

const double pi=acos(-1.0);//NOTES:pi

const double eps=1e-11;//NOTES:eps

template<class T> inline void checkmin(T &a,T b){if(b<a) a=b;}//NOTES:checkmin(

template<class T> inline void checkmax(T &a,T b){if(b>a) a=b;}//NOTES:checkmax(

template<class T> inline T sqr(T x){return x*x;}//NOTES:sqr

int lsb(unsigned int v){
	int r;           // result goes here
	static const int MultiplyDeBruijnBitPosition[32] =
	{
	  0, 1, 28, 2, 29, 14, 24, 3, 30, 22, 20, 15, 25, 17, 4, 8,
	  31, 27, 13, 23, 21, 19, 16, 7, 26, 12, 18, 6, 11, 5, 10, 9
	};
	r = MultiplyDeBruijnBitPosition[((uint32_t)((v & -v) * 0x077CB531U)) >> 27];
	return r+1;
}

template<class T> inline int msb(T n){return (n==0)?0:(1+msb(n>>1));}//NOTES:msb(
template<class T> inline T getbit(T n,int pos){return ((n&(1<<pos))?1:0);}//NOTES:getbit(
template<class T> inline int countbit(T n){return (n==0)?0:(1+countbit(n&(n-1)));}//NOTES:countbit(

//Numberic Functions

template<class T> inline T gcd(T a,T b)//NOTES:gcd(
  {if(a<0)return gcd(-a,b);if(b<0)return gcd(a,-b);return (b==0)?a:gcd(b,a%b);}

bool isequal(vector<int> a,vector<int> b){
	REP(i,a.size()) if(a[i]!=b[i]) return false;
	return true;
}

template<class T>
bool allequal(vector<T> a){
	sor(a);
	return a[0]==a[a.size()-1];
}

template<class T>
void printarray(vector<T> a){
	REP(i,a.size())cout << a[i] << " ";
	cout<< endl;
}

template<class T>
void printsubarray(vector<T> a,int start ,int end){
	if(start<0 or end>a.size()-1) cout << "Out of bounds" << endl;
	for(int i=start;i<=end;i++)cout << a[i] << " ";
	cout<< endl;
}

bool isprime(int n){
	if(n<2) return false;
	if(n==2) return true;
	for(int i=2;i*i<=n;i++){
		if(n%i==0) return false;
	}
	return true;
}

// Error checking

#define error(args...) { vector<string> _v; split(#args, ',', _v); err(_v.begin(), args); }

void split(const string& s, char c, vector<string>& result) {
    stringstream ss(s);
    string x;
    while (getline(ss, x, c))
        result.push_back(x);
}

void err(vector<string>::iterator it) {}
template<typename T, typename... Args>
void err(vector<string>::iterator it, T a, Args... args) {
    cerr << it -> substr((*it)[0] == ' ', it -> length()) << " = " << a << '\n';
    err(++it, args...);
}

/*
 error(a, b, c)
std. error output:
 a = 4
 b = 8
 c = 9
*/

//ENDTEMPLATE_BY_ACRUSH_TOPCODER

void readarray(vector<ll>& a,int size){
	ll tmp;
	a.clear();
	REP(i,size){
		cin>>tmp;
		a.push_back(tmp);
	}
}

bool invalid(int n,int k){
	int nbits = countbit(n);
	if(k<nbits or k>n) return false;
	return true;
}
void solvecase(){
	int n;
	ll xr=0,sum=0,t=0,pad=0;
	vector<long long> a;
	cin >> n;
	readarray(a,n);
	for(ll t:a){
		sum+=t;
		xr ^=t;
	}
	//if(2*xr<sum+2){
	pad = (1LL<<(1+msb(sum)));
	if(sum%2LL)pad--;
	//}
	xr^=pad;
	sum+=pad;
	t = (2*xr-sum)>>1;
	error(sum,xr,pad,t);
	cout << "3\n" << t << " " << t << " " << pad << endl;
}

int main() {
  int cases=1;
  cin >> cases;
  while(cases--){
	  solvecase();
  }
  return 0;
}


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

#define endl '\n'
#define int long long

const int mod = 1e9+7;

int get(int num) {

	int len = 0;
	while(num) {
		num/=2;
		len++;
	}

	return len;
}

int32_t main() {

	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

    #ifndef ONLINE_JUDGE
    freopen("inp.txt", "r", stdin);
    freopen("out.txt", "w", stdout);
    #endif

    	int t; cin>>t;

    	while(t--) {

    			int n; cin>>n;

    			int sm=0,xr=0;

    			for(int i=0;i<n;i++) {
    				int num; cin>>num;

    				sm+=num;
    				xr^=num;
    			}

    			int ind = max(get(sm),get(xr));
    			ind++;

    			int a1 = 1LL<<ind;

    			if(sm&1) a1++;

    			int a2 = (2*(xr^a1)-sm-a1)/2;

    			cout<<3<<endl;

    			cout<<a1<<' '<<a2<<' '<<a2<<endl;
    	}

    return 0;

}


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

#define endl '\n'

typedef long long int ll;

const int mod = 1e9+7;

int get(int num) {

	int len = 0;
	while(num) {
		num/=2;
		len++;
	}

	return len;
}

int main() {

	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

    #ifndef ONLINE_JUDGE
    freopen("inp.txt", "r", stdin);
    freopen("out.txt", "w", stdout);
    #endif

    	int t; cin>>t;

    	while(t--) {

    			int n; cin>>n;

    			ll sm=0,xr=0;

    			for(int i=0;i<n;i++) {
    				int num; cin>>num;

    				sm+=num;
    				xr^=num;
    			}

    			int ind = max(get(sm),get(xr));w
    			ind++;

    			ll a1 = 1LL<<ind;

    			if(sm&1) a1++;

    			sm+=a1;
    			xr^=a1;

    			int a2 = (2*xr-sm)/2;

    			cout<<3<<endl;

    			cout<<a1<<' '<<a2<<' '<<a2<<endl;
    	}

    return 0;

}


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

#define endl '\n'

typedef long long int ll;

const int mod = 1e9+7;

int get(int num) {

	int len = 0;
	while(num) {
		num/=2;
		len++;
	}

	return len;
}

int main() {

	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

    #ifndef ONLINE_JUDGE
    freopen("inp.txt", "r", stdin);
    freopen("out.txt", "w", stdout);
    #endif

    	int t; cin>>t;

    	while(t--) {

    			ll n; cin>>n;

    			ll sm=0,xr=0;

    			for(ll i=0;i<n;i++) {
    				ll num; cin>>num;

    				sm+=num;
    				xr^=num;
    			}

    			ll ind = max(get(sm),get(xr));
    			ind++;

    			ll a1 = 1LL<<ind;

    			if(sm&1) a1++;

    			ll a2 = (2LL*(xr^a1)-(sm+a1))/2;

    			cout<<3<<endl;

    			cout<<a1<<' '<<a2<<' '<<a2<<endl;
    	}

    return 0;

}


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

#define endl '\n'

typedef long long int ll;

const int mod = 1e9+7;

int get(int num) {

	int len = 0;
	while(num) {
		num/=2;
		len++;
	}

	return len;
}

int main() {

	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

    #ifndef ONLINE_JUDGE
    freopen("inp.txt", "r", stdin);
    freopen("out.txt", "w", stdout);
    #endif

    	int t; cin>>t;

    	while(t--) {

    			ll n; cin>>n;

    			ll sm=0,xr=0;

    			for(ll i=0;i<n;i++) {
    				ll num; cin>>num;

    				sm+=num;
    				xr^=num;
    			}

    			ll ind = max(get(sm),get(xr));
    			ind++;

    			ll a1 = 1LL<<ind;

    			if(sm&1) a1++;

    			ll a2 = (2*(xr^a1)-sm-a1)/2;

    			cout<<3<<endl;

    			cout<<a1<<' '<<a2<<' '<<a2<<endl;
    	}

    return 0;

}


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

#define endl '\n'

typedef long long int ll;

const int mod = 1e9+7;

int get(int num) {

	int len = 0;
	while(num) {
		num/=2;
		len++;
	}

	return len;
}

int main() {

	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

    #ifndef ONLINE_JUDGE
    freopen("inp.txt", "r", stdin);
    freopen("out.txt", "w", stdout);
    #endif

    	int t; cin>>t;

    	while(t--) {

    			int n; cin>>n;

    			ll sm=0,xr=0;

    			for(int i=0;i<n;i++) {
    				int num; cin>>num;

    				sm+=num;
    				xr^=num;
    			}

    			int ind = max(get(sm),get(xr));
    			ind++;

    			ll a1 = 1LL<<ind;

    			if(sm&1) a1++;

    			sm+=a1;
    			xr^=a1;

    			ll a2 = (2LL*xr-sm)/2;

    			cout<<3<<endl;

    			cout<<a1<<' '<<a2<<' '<<a2<<endl;
    	}

    return 0;

}


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

#define endl '\n'

typedef long long int ll;

const int mod = 1e9+7;

int get(int num) {

	int len = 0;
	while(num) {
		num/=2;
		len++;
	}

	return len;
}

int main() {

	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

    #ifndef ONLINE_JUDGE
    freopen("inp.txt", "r", stdin);
    freopen("out.txt", "w", stdout);
    #endif

    	int t; cin>>t;

    	while(t--) {

    			int n; cin>>n;

    			ll sm=0,xr=0;

    			for(int i=0;i<n;i++) {
    				int num; cin>>num;

    				sm+=num;
    				xr^=num;
    			}

    			int ind = max(get(sm),get(xr));
    			ind++;

    			ll a1 = 1<<ind;

    			if(sm&1) a1++;

    			sm+=a1;
    			xr^=a1;

    			int a2 = (2*xr-sm)/2;

    			cout<<3<<endl;

    			cout<<a1<<' '<<a2<<' '<<a2<<endl;
    	}

    return 0;

}


#include<bits/stdc++.h>

using namespace std;

typedef long long ll;
#define f first
#define s second

const int MAXN = 1000*1000 + 100;

vector<ll> ans;

//ll mod = 998244353;

//
//
//

ll pw(ll x, ll n)
{
	if(n == 0)
	{
		return 1;
	}
	else if(n%2 == 0)
		return pw(x*x, n/2);
	return pw(x*x, n/2)*x;
}

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

	int q;
	cin >> q;
	while(q--)
	{
		ans.clear();
		int n;
		cin >> n;
		ll x = 0, s = 0;
		ll o = pw(2, 32), k = 0;
		for(int i = 0; i < n; i++)
		{
			ll a;
			cin >> a;
			x = x^a;
			s += a;
			if(a%2 == 1)
				k = a;
		}
		if(s % 2 == 1)
		{
			o += k;
		}
		s += o;
		x = x^o;

		s = 2*x - s;
		if(s != 0)
		{
			cout << 3 << endl;
			cout << s/2 << ' ' << s/2 << ' ' << o << endl;
		}
		else
		{
			cout << 1 << endl;
			cout << o << endl;
		}

	}

	return 0;
}


#include<bits/stdc++.h>

using namespace std;

typedef long long ll;
#define f first
#define s second

const int MAXN = 1000*1000 + 100;

vector<ll> ans;

//ll mod = 998244353;

//
//
//

ll pw(ll x, ll n)
{
	if(n == 0)
	{
		return 1;
	}
	else if(n%2 == 0)
		return pw(x*x, n/2);
	return pw(x*x, n/2)*x;
}

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

	int q;
	cin >> q;
	while(q--)
	{
		ans.clear();
		int n;
		cin >> n;
		ll x = 0, s = 0;
		ll o = pw(2, 34), k = 0;
		for(int i = 0; i < n; i++)
		{
			ll a;
			cin >> a;
			x = x^a;
			s += a;
			if(a%2 == 1)
				k = a;
		}
		if(s % 2 == 1)
		{
			o += k;
		}
		s += o;
		x = x^o;

		s = 2*x - s;
		if(s != 0)
		{
			cout << 3 << endl;
			cout << s/2 << ' ' << s/2 << ' ' << o << endl;
		}
		else
		{
			cout << 1 << endl;
			cout << o << endl;
		}

	}

	return 0;
}


#include<bits/stdc++.h>

using namespace std;

typedef long long ll;
#define f first
#define s second

const int MAXN = 1000*1000 + 100;

vector<ll> ans;

//ll mod = 998244353;

//
//
//

ll pw(ll m, ll n)
{
	if(n == 0)
	{
		return 1;
	}
	else if(n%2 == 0)
		return pw(m*m, n/2);
	return pw(m*m, n/2)*m;
}

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

	int q;
	cin >> q;
	ll p = pw(2, 42);
	while(q--)
	{
		ans.clear();
		int n;
		cin >> n;
		ll x = 0, s = 0;
		ll o = p, k = 0;
		//cout << o << endl;
		for(int i = 0; i < n; i++)
		{
			ll a;
			cin >> a;
			x = x^a;
			s += a;
			if(a%2 == 1)
				k = a;
		}
		if(s % 2 == 1)
		{
			o += k;
		}
		s += o;
		x = x^o;

		s = 2*x - s;
		if(s != 0)
		{
			cout << 3 << endl;
			cout << s/2 << ' ' << s/2 << ' ' << o << endl;
		}
		else
		{
			cout << 1 << endl;
			cout << o << endl;
		}

	}

	return 0;
}


#include<bits/stdc++.h>

using namespace std;

typedef long long ll;
#define f first
#define s second

const int MAXN = 1000*1000 + 100;

vector<ll> ans;

//ll mod = 998244353;

//
//
//

ll pw(ll m, ll n)
{
	if(n == 0)
	{
		return 1;
	}
	else if(n%2 == 0)
		return pw(m*m, n/2);
	return pw(m*m, n/2)*m;
}

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

	int q;
	cin >> q;
	ll p = pw(2, 60);
	while(q--)
	{
		ans.clear();
		int n;
		cin >> n;
		ll x = 0, s = 0;
		ll o = p, k = 0;
		//cout << o << endl;
		for(int i = 0; i < n; i++)
		{
			ll a;
			cin >> a;
			x = x^a;
			s += a;
			if(a%2 == 1)
				k = a;
		}
		if(s % 2 == 1)
		{
			o += k;
		}
		s += o;
		x = x^o;

		s = 2*x - s;
		if(s != 0)
		{
			cout << 3 << endl;
			cout << s/2 << ' ' << s/2 << ' ' << o << endl;
		}
		else
		{
			cout << 1 << endl;
			cout << o << endl;
		}

	}

	return 0;
}


#include<bits/stdc++.h>

using namespace std;

typedef long long ll;
#define f first
#define s second

const int MAXN = 1000*1000 + 100;

vector<ll> ans;

//ll mod = 998244353;

//
//
//

ll pw(ll m, ll n)
{
	if(n == 0)
	{
		return 1;
	}
	else if(n%2 == 0)
		return pw(m*m, n/2);
	return pw(m*m, n/2)*m;
}

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

	int q;
	cin >> q;
	ll p = pw(2, 55);
	while(q--)
	{
		ans.clear();
		int n;
		cin >> n;
		ll x = 0, s = 0;
		ll o = p, k = 0;
		//cout << o << endl;
		for(int i = 0; i < n; i++)
		{
			ll a;
			cin >> a;
			x = x^a;
			s += a;
			if(a%2 == 1)
				k = a;
		}
		if(s % 2 == 1)
		{
			o += k;
		}
		s += o;
		x = x^o;

		s = 2*x - s;
		if(s != 0)
		{
			cout << 3 << endl;
			cout << s/2 << ' ' << s/2 << ' ' << o << endl;
		}
		else
		{
			cout << 1 << endl;
			cout << o << endl;
		}

	}

	return 0;
}


#include <bits/stdc++.h>

#define MAXN 200005
#define LL long long
#define pii pair<int, int>
#define fi first
#define se second
#define fastio ios::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);

using namespace std;

int t;
string s;
LL cur;
LL past;
LL mod = 1e9+7;

signed main() {
    cin >> t;
    while (t--) {
        int x;
        cin >> x;
        cin >> s;
        int l = 0;
        cur = s.size();
        past = 0;
        while (l != x) {
            l++;
            past++;
            past %= mod;
            cur--;
            if (cur < 0) cur += mod;
            int j = s[l-1] - '0' - 1;
            cur = (cur + cur * j % mod) % mod;
            if (s.size() < x) {
                string mmm = s.substr(l);
                while (j--)
                    s += mmm;
            }
        }
        cout << (past + cur) % mod << endl;
    }
    return 0;
}


#include <bits/stdc++.h>

#define MAXN 200005
#define LL long long
#define pii pair<int, int>
#define fi first
#define se second
#define fastio ios::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);

using namespace std;

int t;
string s;
LL cur;
LL past;
LL mod = 1e9+7;

signed main() {
    cin >> t;
    while (t--) {
        int x;
        cin >> x;
        cin >> s;
        int l = 0;
        cur = s.size();
        past = 0;
        while (l != x) {
            l++;
            past++;
            past %= mod;
            cur--;
            int j = s[l-1] - '0' - 1;
            cur = (cur + cur * j % mod) % mod;
            if (s.size() < 1000000) {
                while (j--)
                    s += s.substr(l);
            }
        }
        cout << (past + cur) % mod << endl;
    }
    return 0;
}


#include <bits/stdc++.h>

#define MAXN 200005
#define LL long long
#define pii pair<int, int>
#define fi first
#define se second
#define fastio ios::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);

using namespace std;

int t;
string s;
LL cur;
LL past;
LL mod = 1e9+7;

signed main() {
    cin >> t;
    while (t--) {
        int x;
        cin >> x;
        cin >> s;
        int l = 0;
        cur = s.size() % mod;
        past = 0;
        while (l != x) {
            l++;
            int j = s[l-1] - '0' - 1;
            cur = (cur + (cur - l) * j % mod) % mod;
            if (s.size() < 1000000) {
                string mmm = s.substr(l);
                while (j--)
                    s += mmm;
            }
        }
        cout << cur << endl;
    }
    return 0;
}


#include <bits/stdc++.h>

#define MAXN 200005
#define LL long long
#define pii pair<int, int>
#define fi first
#define se second
#define fastio ios::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);

using namespace std;

int t;
string s;
LL cur;
LL past;
LL mod = 1e9+7;

signed main() {
    cin >> t;
    while (t--) {
        int x;
        cin >> x;
        cin >> s;
        int l = 0;
        cur = s.size();
        past = 0;
        while (l != x) {
            l++;
            past++;
            past %= mod;
            cur--;
            if (cur < 0 ) cur += mod;
            int j = s[l-1] - '0' - 1;
            cur = (cur + cur * j % mod) % mod;
            if (s.size() < 1000000) {
                while (j--)
                    s += s.substr(l);
            }
        }
        cout << (past + cur) % mod << endl;
    }
    return 0;
}


#include <bits/stdc++.h>

#define MAXN 200005
#define LL long long
#define pii pair<int, int>
#define fi first
#define se second
#define fastio ios::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);

using namespace std;

int t;
string s;
LL cur;
LL past;
LL mod = 1e9+7;

signed main() {
    cin >> t;
    while (t--) {
        int x;
        cin >> x;
        cin >> s;
        int l = 0;
        cur = s.size() % mod;
        past = 0;
        while (l != x) {
            l++;
            int j = s[l-1] - '0' - 1;
            cur = (cur + (cur - l) * j % mod) % mod;
            if (s.size() < 1000000) {
                while (j--)
                    s += s.substr(l);
            }
        }
        cout << cur << endl;
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define mod 1000000007
#define cin1(x) cin>>x
#define cin2(x,y) cin>>x>>y
#define cin3(x,y,z) cin>>x>>y>>z
#define ll long long
#define mp make_pair
#define pb push_back
#define nl printf("\n")
#define ff first
#define ss second
#define set0(a) memset ((a), 0 , sizeof(a))
#define set1(a) memset((a),-1,sizeof (a))
#define pi pair<int, int>
#define ps pair<string, string>
#define pl pair<long, long>
#define pll pair<long long, long long>
#define vll vector<long long>
#define vl vector<long>
#define vi vector<int>
#define vs vector<string>
#define vps vector< ps >
#define vpi vector< pi >
#define vpl vector< pl >
#define vpll vector< pll >
#define flash  ios_base::sync_with_stdio(false); cin.tie(NULL);
#define tc(t,T) for(long long t=0;t<T;t++)
#define rep(i,s,n,d) for(long long i=s;i<n;i=i+d)
const int todx[] = { -2, -2, -1, -1,  1,  1,  2,  2 };
const int tody[] = { -1,  1, -2,  2, -2,  2, -1,  1 };
bool sortbysec(const pll &a,
              const pll &b)
{
    return (a.second < b.second);
}
/*bool cxp pair<ll, pll> &a,
              const pair<ll, pll> &b)
{
    return (a.ff < b.ff);
}*/

void func(void)
{
        freopen("input.txt","r",stdin);
        freopen("output.txt","w",stdout);
}
ll gcd(ll a,ll b){
    if(b==0)return a;
    else return gcd(b,a%b);
}
void printStack(stack<string> s){
    if(s.empty())return;

    string x=s.top();
    s.pop();
    printStack(s);
    cout<<x;
    s.push(x);

}

ll binaryexp(ll n,ll p){

    if(p==0) return 1;
    if(p%2==0) return binaryexp((n%mod)*(n%mod),p/2);
    else return ((n%mod)*binaryexp(((n%mod)*(n%mod))%mod,(p-1)/2)%mod);

}

#define meax 10000001
vll spf(meax,0);
void siv(){
    spf[1]=1;

   for(ll i=2;i<meax;i++)spf[i]=i;

   for(ll i=4;i<meax;i+=2){
        spf[i]=2;
    }
    for(ll i=3;i*i<meax;i++){
        if(spf[i]==i){
            for(ll j=i*i;j<meax;j+=i){
                if(spf[j]==j){
                    spf[j]=i;
                }
            }
        }
    }
}

void adder(string s,ll num,ll x){

}
ll chalok(string s,ll cnt,ll sz,ll x){
	ll num1=0;
	ll ssize=s.size();
	string s1;
	string s3;

	ll next1=s[cnt]-'0';
	while(cnt!=x){

		num1=s[cnt]-'0';

		//cout<<num1<<endl;
		cnt++;

		ll tod=((ssize-cnt)%mod+mod)%mod;
		ssize=cnt;
		ssize=(ssize+((tod%mod)*(num1%mod))%mod)%mod;
		ll cur=s.size();
		if(num1!=1){
		if(cur<10000007){
			for(int i=cnt;i<cur;i++){
				s1+=s[i];
			}
			s3+=s[cnt-1];
			s.clear();
			s=s3;
		 for(ll i=0;i<num1;i++){
			s+=s1;
			if(s.size()>1000006)break;
			}
			//cout<<s.size()<<endl;

		}
		}
		s1.clear();
		s3.clear();
		//cout<<ssize<<endl;

		//cout<<s<<endl;

	}
	return ssize;

}

int main(){
 ll T;
 cin>>T;
 //flash;
 tc(t,T){
 	ll x;
 	cin>>x;
 	string s;
 	cin>>s;
 	ll cnt=0;
 	ll sz=0;
 	ll ans=chalok(s,0,0,x);
 	cout<<ans<<endl;
 }
}