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