#include <bits/stdc++.h>
using namespace std;
int main() {
  int q;
  cin >> q;
  while (q--) {
    long long n, sum = 0, x = 0;
    cin >> n;
    vector<long long> v(n);
    for (int i = 0; i < n; i++) {
      cin >> v[i];
      sum += v[i];
      x ^= v[i];
    }
    if (sum == 2 * x)
      cout << 0 << "\n"
           << "\n";
    else {
      long long y = x + sum;
      cout << 2 << "\n";
      cout << x << " " << y << "\n";
    }
  }
  return 0;
}
