#include <bits/stdc++.h>
using namespace std;
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long t;
  cin >> t;
  while (t--) {
    long long n, a;
    cin >> n;
    long long second = 0, x = 0;
    for (long long i = 0; i < n; i++) {
      cin >> a;
      second += a;
      x ^= a;
    }
    cout << 2 << endl << x << " " << second + x << endl;
  }
  return 0;
}
