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