#include <bits/stdc++.h>
#pragma GCC optimize("O3")
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
long long mod = 1e9 + 7;
const long long e = 100001;
long long arr[1000001];
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long t;
  cin >> t;
  while (t--) {
    long long n;
    cin >> n;
    long long s = 0;
    long long x = 0;
    for (long long i = 0; i < n; i++) {
      cin >> arr[i];
      x ^= arr[i];
      s += arr[i];
    }
    cout << 2 << endl;
    cout << x << " " << s + x << endl;
  }
}
