#include <bits/stdc++.h>
using namespace std;
long long inf = 1000000000000000007;
long long mod = 1000000007;
vector<long long> adj[100005];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  bool flag = true;
  long long test_case = 1, tc;
  if (flag) cin >> test_case;
  tc = test_case;
  while (tc--) {
    long long i, j, k, n, m, t, x, y, z, sum = 0, xori = 0, ans = 0, c = 0,
                                         flag = 0;
    long long maxi = -1e9, mini = 1e9;
    vector<long long> v;
    map<long long, long long> mp;
    string s;
    cin >> n;
    long long a[n + 5];
    for (i = 0; i < n; i++) {
      cin >> a[i];
      sum += a[i];
      xori ^= a[i];
    }
    if (xori == 0) {
      x = sum;
      y = sum;
      sum += (x + y);
      z = sum;
      cout << 3 << "\n";
      cout << x << " " << y << " " << z << "\n";
    } else if (sum != (2 * xori)) {
      x = xori;
      sum += x;
      y = sum;
      cout << 2 << "\n";
      cout << x << " " << y << "\n";
    } else {
      cout << 0 << "\n";
      cout << endl;
    }
  }
  return 0;
}
