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