#include <bits/stdc++.h>
using namespace std;
const int MAX = 100010;
const bool UVA = true;
int n;
int arr[MAX];
void go() {
  scanf("%d", &n);
  long long sum = 0, xr = 0;
  for (int i = 0; i < n; i++) {
    scanf("%d", &arr[i]);
    sum += arr[i];
    xr ^= arr[i];
  }
  printf("2\n");
  printf("%lld %lld\n", xr, xr + sum);
}
int main() {
  int t = 1;
  if (UVA) scanf("%d", &t);
  while (t--) go();
}
