#include <bits/stdc++.h>
using namespace std;
void cal(long long number, long long x, long long s) {
  long long d = number ^ x;
  long long temp = 2 * number - (s + d);
  if (temp % 2 == 0) {
    cout << 3 << endl;
    cout << d << " " << temp / 2 << " " << temp / 2 << endl;
  }
  if (temp % 2 == 1) {
    number -= 1;
    d = number ^ x;
    temp = 2 * number - (s + d);
    cout << 3 << endl;
    cout << d << " " << temp / 2 << " " << temp / 2 << endl;
  }
}
void solve() {
  long long n;
  cin >> n;
  vector<long long> a(n);
  long long s = 0, x = 0, number = 0;
  for (long long i = 0; i < 57; i++) {
    number = number | 1LL << i;
  }
  for (long long i = 0; i < n; i++) {
    cin >> a[i];
    s = s + a[i];
    x = x ^ a[i];
  }
  cal(number, x, s);
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long t = 1;
  cin >> t;
  while (t--) solve();
  return 0;
}
