#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    ll sum = 0, x = 0;
    for (int i = 0; i < n; ++i) {
      ll p;
      cin >> p;
      x ^= p;
      sum += p;
    }
    cout << 2 << '\n' << x << ' ' << sum + x << '\n';
  }
  return 0;
}
