#include <bits/stdc++.h>
using namespace std;
long long int sumofd(long long int a) {
  long long int c = 0;
  while (a != 0) {
    c += a % 10;
    a = a / 10;
  }
  return c;
}
bool sortbysec(const pair<long long int, long long int> &a,
               const pair<long long int, long long int> &b) {
  return (a.second < b.second);
}
void oblivious() {
  long long int n;
  cin >> n;
  long long int a[n];
  long long int s = 0, x = 0;
  for (long long int i = 0; i < n; i++) {
    cin >> a[i];
    s += a[i];
    x ^= a[i];
  }
  cout << "2" << endl;
  cout << x << " " << s + x << endl;
}
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long int t = 1;
  cin >> t;
  while (t--) {
    oblivious();
  }
  return 0;
}
