#include <bits/stdc++.h>
using namespace std;
int main() {
  std::ios::sync_with_stdio(false);
  cin.tie(NULL);
  long long int t;
  cin >> t;
  while (t--) {
    long long int n;
    cin >> n;
    long long int res = 0;
    long long int sum = 0;
    for (long long int i = 1; i <= n; i++) {
      long long int x;
      cin >> x;
      res ^= x;
      sum += x;
    }
    vector<long long int> ans;
    ans.push_back(res);
    ans.push_back(sum + res);
    cout << 2 << endl;
    for (auto it : ans) cout << it << " ";
    cout << endl;
  }
  return 0;
}
