#include <bits/stdc++.h>
using namespace std;
const int maxx = 1e5 + 7;
int cas, n;
long long a[maxx];
int main() {
  scanf("%d", &cas);
  while (cas--) {
    long long sum = 0LL, sum_xor = 0LL;
    scanf("%d", &n);
    for (int i = 1; i <= n; i++) {
      scanf("%lld", &a[i]);
      sum += a[i];
      sum_xor ^= a[i];
    }
    if (sum == sum_xor << 1LL)
      printf("0\n\n");
    else {
      printf("2\n");
      printf("%lld %lld\n", sum_xor, sum + sum_xor);
    }
  }
  return 0;
}
