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