#include <bits/stdc++.h>
using namespace std;
const int maxn = 100010;
int T, n, a[maxn];
int main() {
  scanf("%d", &T);
  while (T--) {
    scanf("%d", &n);
    long long s1 = 0, s2 = 0;
    for (int i = 1; i <= n; i++) {
      scanf("%d", &a[i]);
      s1 += a[i], s2 ^= a[i];
    }
    printf("2\n");
    printf("%lld %lld\n", s2, s1 + s2);
  }
  return 0;
}
