#include <bits/stdc++.h>
using namespace std;
int read() {
  char a = getchar();
  int b = 1, n = 0;
  while (a < '0' || a > '9') {
    if (a == '-') b = -1;
    a = getchar();
  }
  while (a >= '0' && a <= '9') n = n * 10 + a - 48, a = getchar();
  return n * b;
}
int main() {
  int t = read();
  while (t--) {
    long long n = read(), h = 0, xr = 0, s;
    while (n--) {
      s = read();
      h += s;
      xr ^= s;
    }
    h += xr;
    cout << 2 << endl << h << ' ' << xr << endl;
  }
  return 0;
}
