#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll mod = (ll)(1e9 + 7);
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  ll t = 1;
  cin >> t;
  while (t--) {
    ll n, x = 0, s = 0;
    cin >> n;
    vector<ll> a;
    for (ll i = 0; i < n; i++) {
      ll temp;
      cin >> temp;
      x ^= temp;
      s += temp;
    }
    if (s == 2 * x)
      cout << 0 << "\n"
           << "\n";
    else
      cout << 2 << "\n" << x << ' ' << s + x << "\n";
  }
  return 0;
}
