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