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