#include <bits/stdc++.h>
using namespace std;
void solve() {
  map<long long, long long> mp;
  long long n, m, j, y, i, k, x, d, l, r;
  cin >> n;
  long long a[n + 1];
  long long sum = 0;
  for (i = 0; i < n; i++) {
    cin >> a[i];
    sum += a[i];
  }
  x = a[0];
  for (i = 1; i < n; i++) {
    x = x ^ a[i];
  }
  if (sum == 2 * x) {
    cout << 0 << endl;
    return;
  }
  cout << 2 << endl;
  cout << x << " " << sum + x << endl;
}
int main() {
  int T;
  cin >> T;
  while (T--) solve();
  return 0;
}
