#include <bits/stdc++.h>
const int long long N = 10e8 + 7;
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    int arr[n];
    int long long sum = 0, x = 0;
    for (int i = 0; i < n; i++) {
      cin >> arr[i];
      sum += arr[i];
      x ^= arr[i];
    }
    sum += x;
    int long long val = sum;
    cout << "2" << '\n';
    cout << x << " " << val << '\n';
  }
}
