#include <bits/stdc++.h>
using namespace std;
signed main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  long long t;
  cin >> t;
  while (t--) {
    long long n, s = 0, x = 0, a;
    cin >> n;
    for (long long i = 0; i < n; i++) {
      cin >> a;
      s += a;
      x ^= a;
    }
    if (s == 2 * x)
      cout << 0 << endl;
    else {
      cout << 2 << endl;
      cout << x << " " << x + s << endl;
    }
  }
}
