#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
long long t;
long long n;
long long a[100005];
int main() {
  cin >> t;
  while (t--) {
    cin >> n;
    for (int i = 1; i <= n; i++) cin >> a[i];
    long long sum = a[1], xr = a[1];
    for (int i = 2; i <= n; i++) sum += a[i], xr = xr xor a[i];
    cout << 2 << endl;
    cout << xr << " " << xr + sum << endl;
  }
}
