#include <bits/stdc++.h>
using namespace std;
const long long oo = (long long)1e16;
long long n, m, ID, l, nb;
long long t[2000000];
vector<long long> v[2000000];
long long graph[205][205];
long long head[2000000], to[2000000], nxt[2000000], cap[2000000], src, snk;
long long vis[2000000];
long long e, a, b;
set<int> st;
map<long long, long long> mapp;
map<long long, long long>::iterator it;
int main() {
  ios_base::sync_with_stdio(0);
  cin >> nb;
  while (nb--) {
    cin >> n;
    long long cnt = 0;
    long long xo = 0;
    for (int i = 0; i < n; i++) {
      cin >> a;
      cnt += a;
      xo ^= a;
    }
    cout << 2 << '\n';
    cout << xo << " " << cnt + xo << '\n';
  }
}
