#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    vector<int> a(n);
    ll sum = 0;
    ll xsum = 0;
    for (int i = 0; i < n; i++) {
      cin >> a[i];
      sum = sum + a[i];
      xsum = xsum ^ a[i];
    }
    sum = sum + xsum;
    cout << "2\n";
    cout << xsum << " " << sum << "\n";
  }
  return 0;
}
