#include <bits/stdc++.h>
using namespace std;
long long M = 1e9 + 7;
void solve() {
  long long int n;
  cin >> n;
  vector<long long int> a(n);
  long long int sum = 0;
  long long int x = 0;
  for (long long int i = 0; i < n; i++) {
    cin >> a[i];
    sum += a[i];
    x = x ^ a[i];
  }
  cout << 2 << "\n";
  cout << x << " " << sum + x << "\n";
}
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  long long int t;
  cin >> t;
  while (t--) {
    solve();
  }
}
