#include <bits/stdc++.h>
using namespace std;
long long t;
long long n;
long long a[100005];
int main() {
  cin >> t;
  while (t--) {
    cin >> n;
    for (long long i = 0; i < n; i++) cin >> a[i];
    long long suma = 0, ksor = 0;
    for (long long i = 0; i < n; i++) {
      suma += a[i];
      ksor ^= a[i];
    }
    cout << 2 << "\n" << ksor << " " << ksor + suma << "\n";
  }
  return 0;
}
