#include <bits/stdc++.h>
#pragma GCC optimize("O3")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx")
using namespace std;
int a, b, c, d, n, m, k, kolt;
int mas[200002];
int main() {
  scanf("%d", &kolt);
  for (int _n((kolt)), hod(1); hod <= _n; hod++) {
    scanf("%d", &n);
    long long s = 0, xr = 0;
    for (int _n((n)-1), i(0); i <= _n; i++) {
      scanf("%d", &mas[i]);
      s += mas[i];
      xr ^= mas[i];
    }
    if (s == 2 * xr) {
      printf("0\n\n");
      continue;
    }
    printf("2\n");
    printf("%I64d %I64d\n", xr, s + xr);
  }
}
