#include <bits/stdc++.h>
using namespace std;
using LL = long long;
const double PI = 3.14159265358979323846;
const int INF = 0x3f3f3f3f;
const int MOD = 1e9 + 7;
void solve() {
  int n;
  cin >> n;
  vector<int> bit(64);
  LL sum = 0, ans = 0;
  for (int i = 0; i < int(n); ++i) {
    LL num;
    cin >> num;
    sum += num;
    ans ^= num;
  }
  cout << 2 << endl;
  cout << ans << " " << ans + sum << endl;
}
int main() {
  int t;
  cin >> t;
  while (t--) {
    solve();
  }
  return 0;
}
