#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
const long long inf = 2e18 + 5;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    vector<int> a(n);
    long long s = 0, x = 0;
    for (int i = (0); i < (n); i++) {
      cin >> a[i];
      s += a[i];
      x ^= a[i];
    }
    cout << 2 << endl;
    cout << x << " " << s + x << endl;
  }
  return 0;
}
