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