#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long t;
  cin >> t;
  while (t--) {
    long long n;
    cin >> n;
    long long arr[n];
    long long x, s = 0;
    for (long long i = 0; i < n; i++) {
      cin >> arr[i];
      if (i == 0) {
        x = arr[i];
        s = arr[i];
      } else {
        x = x ^ arr[i];
        s = s + arr[i];
      }
    }
    cout << 2 << endl;
    cout << x << ' ' << s + x << endl;
  }
  return 0;
}
