#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    long long arr[n], sum = 0, xorval = 0;
    int l = 0, r = 0;
    for (int i = 0; i < n; i++) {
      cin >> arr[i];
      sum += arr[i];
      xorval = xorval xor arr[i];
    }
    if (2 * xorval == sum)
      cout << 0 << endl;
    else {
      if (xorval == 0) {
        cout << 1 << endl;
        cout << sum << endl;
      } else {
        cout << 2 << endl;
        cout << xorval << " " << sum + xorval << endl;
      }
    }
  }
  return 0;
}
