#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  ;
  long long test = 1;
  cin >> test;
  while (test--) {
    long long n;
    cin >> n;
    long long a[n];
    long long sum = 0;
    long long x = 0;
    for (long long i = 0; i < n; i++) {
      cin >> a[i];
      sum += a[i];
      x ^= a[i];
    }
    if (sum == 2 * x) {
      cout << 0 << endl;
      cout << endl;
    } else {
      cout << 2 << endl;
      cout << x << " " << sum + x << endl;
    }
  }
  return 0;
}
