#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
  ll tc;
  cin >> tc;
  while (tc--) {
    ll n, sum = 0;
    cin >> n;
    ll a[n + 1];
    for (int i = 0; i < n; i++) {
      cin >> a[i];
      sum += a[i];
    }
    ll x = a[0];
    for (int i = 1; i < n; i++) {
      x = x ^ a[i];
    }
    cout << 2 << endl;
    cout << x << " " << sum + x << endl;
  }
  return 0;
}
