#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(0);
  int n, T;
  cin >> T;
  while (T--) {
    cin >> n;
    long long x = 0, s = 0;
    for (int i = 0; i < n; i++) {
      int t = 0;
      cin >> t;
      x ^= t;
      s += t;
    }
    cout << 2 << endl;
    cout << x << " " << x + s << endl;
  }
  cin >> n;
  return 0;
}
