#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 9;
long long sum, X;
long long a[maxn];
int main() {
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    int flag = 0;
    X = 0, sum = 0;
    for (int i = 1; i <= n; i++) {
      cin >> a[i];
      X ^= a[i];
      sum += a[i];
    }
    puts("2");
    cout << X << " " << sum + X << endl;
  }
  return 0;
}
