#include <bits/stdc++.h>
#pragma GCC optimize("O3")
using namespace std;
const long long MOD = 1000000007;
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long t;
  cin >> t;
  while (t--) {
    long long n;
    cin >> n;
    vector<long long> vec(n);
    long long s = 0, x = 0;
    bool ok = 0;
    for (auto& it : vec) cin >> it, s += it, x ^= it;
    if (s == (2LL * x)) {
      cout << 0 << "\n\n";
      continue;
    }
    vector<long long> ans = {x};
    s += x;
    ans.push_back(s);
    cout << 2 << "\n" << ans[0] << " " << ans[1] << "\n";
  }
  return 0;
}
