#include <bits/stdc++.h>
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
long long posx[] = {1, -1, 0, 0};
long long posy[] = {0, 0, 1, -1};
void solve() {
  long long r = (1ll << 50);
  long long n, i;
  cin >> n;
  long long a[n];
  long long s = 0, x = 0;
  for (i = 0; i < n; i++) {
    cin >> a[i];
    s += a[i];
    x ^= a[i];
  }
  if (s == 2 * x) {
    cout << 0 << '\n' << '\n';
    return;
  }
  if (s % 2) r++;
  s += r;
  x ^= r;
  cout << 3 << '\n';
  long long m = (2 * x - s) / 2;
  cout << r << " " << m << " " << m << '\n';
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int t = 1;
  cin >> t;
  while (t--) {
    solve();
  }
  return 0;
}
