#include <bits/stdc++.h>
using namespace std;
int n, m, u, v, w, t;
long long a[100005];
int main() {
  int T;
  cin >> T;
  while (T--) {
    long long sum1 = 0, sum2 = 0;
    cin >> n;
    for (int i = 0; i < n; ++i) {
      cin >> a[i];
      sum1 += a[i];
      sum2 ^= a[i];
    }
    sum1 += sum2;
    cout << 2 << '\n';
    cout << sum2 << ' ' << sum1 << '\n';
  }
  return 0;
}
