#include <bits/stdc++.h>
using namespace std;
inline void normal(long long int &a) {
  a %= 1000000007;
  (a < 0) && (a += 1000000007);
}
inline long long int modMul(long long int a, long long int b) {
  a %= 1000000007, b %= 1000000007;
  normal(a), normal(b);
  return (a * b) % 1000000007;
}
inline long long int modAdd(long long int a, long long int b) {
  a %= 1000000007, b %= 1000000007;
  normal(a), normal(b);
  return (a + b) % 1000000007;
}
inline long long int modSub(long long int a, long long int b) {
  a %= 1000000007, b %= 1000000007;
  normal(a), normal(b);
  a -= b;
  normal(a);
  return a;
}
inline long long int modPow(long long int b, long long int p) {
  long long int r = 1;
  while (p) {
    if (p & 1LL) r = modMul(r, b);
    b = modMul(b, b);
    p >>= 1LL;
  }
  return r;
}
inline long long int modInverse(long long int a) {
  return modPow(a, 1000000007 - 2);
}
inline long long int modDiv(long long int a, long long int b) {
  return modMul(a, modInverse(b));
}
inline long long int mod(long long int a, long long int m) {
  if (a < 0)
    return ((a % m) + m) % m;
  else if (a < m)
    return a;
  else
    return (a % m);
}
bool cmp(pair<int, int> a, pair<int, int> b) {
  if (a.first == b.first)
    return a.second < b.second;
  else
    return a.first < b.first;
}
int main(void) {
  ios::sync_with_stdio(0);
  cin.tie(0);
  long long int t, n, m, k, x, y, a[200001];
  vector<long long int> v, v1, v2;
  vector<pair<long long int, long long int> > p, p1, p2;
  set<long long int> st;
  map<long long int, long long int> mp;
  priority_queue<long long int> pq;
  priority_queue<long long int, vector<long long int>, greater<long long int> >
      lpq;
  priority_queue<pair<long long int, long long int> > phpq;
  priority_queue<pair<long long int, long long int>,
                 vector<pair<long long int, long long int> >,
                 greater<pair<long long int, long long int> > >
      plpq;
  string s;
  cin >> t;
  while (t--) {
    cin >> n;
    long long int sum = 0;
    for (long long int i = 0; i < n; i++) {
      cin >> a[i];
      if (i == 0)
        x = a[i];
      else
        x = x ^ a[i];
      sum += a[i];
    }
    sum += x;
    cout << 2 << endl;
    cout << x << " " << sum << endl;
  }
  return 0;
}
