#include <bits/stdc++.h>
using namespace std;
long long XOR = NULL, SUM = NULL;
int main() {
  int T;
  cin >> T;
  while (T--) {
    XOR = NULL, SUM = NULL;
    int n;
    cin >> n;
    for (int i = 1; i <= n; i++) {
      int x;
      cin >> x;
      XOR ^= x;
      SUM += x;
    }
    cout << 2 << endl << XOR << " " << SUM + XOR << endl;
  }
}
