#include <bits/stdc++.h>
using namespace std;
namespace std {
template <>
struct hash<pair<int, int> > {
  size_t operator()(const pair<int, int>& x) const {
    long long P = 38923, Q = 109797901;
    return (size_t)((x.first * P + x.second) % Q);
  }
};
};  // namespace std
template <class T>
using pqg = priority_queue<T, vector<T>, greater<T> >;
template <typename T, typename second>
ostream& operator<<(ostream& os, const pair<T, second>& v) {
  os << "(" << v.first << ", " << v.second << ")";
  return os;
}
template <typename T>
void print(T t) {
  cout << t << endl << flush;
}
template <typename T, typename... Args>
void print(T t, Args... args) {
  cout << t << " ";
  print(args...);
}
int main() {
  int T;
  cin >> T;
  for (auto t = 0; t < T; t += 1) {
    int n;
    cin >> n;
    vector<int> a(n);
    long long A, B;
    A = 0;
    B = 0;
    for (auto i = 0; i < n; i += 1) {
      cin >> a[i];
      A += a[i];
      B ^= a[i];
    }
    print(2);
    print(B, A + B);
  }
}
