#include <bits/stdc++.h>
using namespace std;
const long long N = 100009;
long long a[N];
long long val;
void setval(long long n) {
  for (int i = 0; i < 32; i++) {
    if ((1 << i) & n) {
      if ((1 << i) & val)
        val = val & ~(1 << i);
      else
        val = val | (1 << i);
    }
  }
}
int main() {
  int _;
  cin >> _;
  while (_--) {
    val = 0;
    long long n, i, j, k, sum = 0, ck = 0;
    cin >> n;
    for (i = 0; i < n; i++) {
      cin >> a[i];
      ck = ck ^ a[i];
      sum += a[i];
      setval(a[i]);
    }
    cout << 2 << endl;
    cout << val << ' ' << sum + val << endl;
  }
  return 0;
}
