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