#include <bits/stdc++.h>
using namespace std;
void solve() {
  long long n;
  cin >> n;
  vector<long long> data(n);
  long long sum = 0;
  for (int i = 0; i < n; i++) {
    cin >> data[i];
    sum += data[i];
  }
  long long x = data[0];
  for (int i = 1; i < n; i++) x ^= data[i];
  if (sum == (2 * x)) {
    cout << "0\n";
    return;
  }
  cout << "2\n";
  cout << x << ' ' << sum + x << '\n';
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int t;
  cin >> t;
  while (t--) {
    solve();
  }
}
