#include <bits/stdc++.h>
using namespace std;
const int mn = 2e5 + 10;
int p[mn];
int main() {
  int tc;
  scanf("%d", &tc);
  while (tc--) {
    int n;
    scanf("%d", &n);
    long long a = 0, b = 0;
    for (int i = 0; i < n; i++) {
      long long x;
      scanf("%lld", &x);
      a += x, b ^= x;
    }
    a += b;
    printf("2\n%lld %lld\n", b, a);
  }
}
