#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(NULL);
  int t;
  cin >> t;
  while (t--) {
    long long int n, arr[100010], s = 0, x = 0;
    cin >> n;
    for (int i = 0; i < n; i++) {
      cin >> arr[i];
      s += arr[i];
      x ^= arr[i];
    }
    cout << 2 << "\n";
    cout << x << " " << s + x << "\n";
  }
  return 0;
}
