#include <bits/stdc++.h>
using namespace std;
long long powmod(long long n, long long x, long long mod) {
  long long result = 1;
  while (x) {
    if (x % 2 != 0) result = (result * n) % mod, x--;
    result = (result * result) % mod;
    x /= 2;
  }
  return result;
}
int32_t main() {
  long long t;
  cin >> t;
  while (t--) {
    long long n;
    cin >> n;
    long long arr[n];
    long long res;
    long long sum = 0;
    for (long long i = 0; i < n; i++) {
      cin >> arr[i];
      if (i == 0)
        res = arr[i];
      else
        res ^= arr[i];
      sum += arr[i];
    }
    if (sum == res * 2LL)
      cout << "0\n\n";
    else if (sum < res * 2LL) {
      if (sum % 2LL == 0) {
        cout << "2\n";
        cout << (res * 2LL - sum) / 2LL << " " << (res * 2LL - sum) / 2LL
             << '\n';
      } else {
        res ^= 1;
        sum++;
        long long yy = res * 2LL;
        if (yy == sum) {
          cout << "1\n";
          cout << "1" << '\n';
        } else if (yy > sum) {
          cout << "3\n";
          cout << "1 " << (res * 2LL - sum) / 2LL << " "
               << (res * 2LL - sum) / 2LL << '\n';
        } else {
          cout << "3\n";
          sum += res;
          cout << "1 " << res << " " << sum << " " << '\n';
        }
      }
    } else {
      cout << "2\n";
      sum += res;
      cout << res << " " << sum << " " << '\n';
    }
  }
}
