#include <bits/stdc++.h>
const int mod = 1e9 + 7;
using namespace std;
void pre() {}
void solve() {
  int n;
  cin >> n;
  int a[n];
  for (int i = 0; i < (int)n; i++) {
    cin >> a[i];
  }
  bool done[n + 1];
  vector<int> ans;
  for (int kaka = 0; kaka < (int)n; kaka++) {
    for (int i = 0; i < (int)n + 1; i++) {
      done[i] = false;
    }
    for (int i = 0; i < (int)n; i++) {
      done[a[i]] = true;
    }
    int mex = n;
    for (int i = 0; i < (int)n + 1; i++) {
      if (!done[i]) {
        mex = i;
        break;
      }
    }
    if (mex == n) {
      int pos = -1;
      for (int i = 0; i < (int)n; i++) {
        if (a[i] != i) {
          pos = i;
          break;
        }
      }
      for (int i = 0; i < (int)n; i++) {
        if (a[i] == pos) {
          ans.push_back(i);
          ans.push_back(pos);
          a[i] = n;
          a[pos] = pos;
          break;
        }
      }
    } else {
      if (a[mex] == mex) {
      } else {
        ans.push_back(mex);
        a[mex] = mex;
      }
    }
  }
  cout << ans.size() << "\n";
  for (int i = 0; i < (int)ans.size(); i++) {
    cout << ans[i] + 1 << " ";
  }
  cout << "\n";
}
int main(int argc, char const *argv[]) {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  pre();
  int test;
  cin >> test;
  while (test--) {
    solve();
  }
  return 0;
}
