#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int t;
  cin >> t;
  while (t--) {
    int n, count = 0;
    cin >> n;
    int a[n + 1];
    for (int i = 1; i <= n; i++) cin >> a[i];
    for (int i = 1; i <= n; i += 2) {
      if (a[i] == 1 && a[i + 1] == 0) {
        count++;
        a[i] = -1;
      }
      if ((a[i] == 0 && a[i + 1] == 1)) {
        count++;
        a[i + 1] = -1;
      }
    }
    cout << n - count << endl;
    for (int i = 1; i <= n; i++) {
      if (a[i] >= 0) cout << a[i] << " ";
    }
    cout << endl;
  }
}
