#include <bits/stdc++.h>
using namespace std;
const int N = (int)(1e5 + 10);
bool isPowerOfTwo(long long int x) { return x && (!(x & (x - 1))); }
void solve() {
  int n;
  cin >> n;
  vector<int> a(n);
  for (int i = 0; i < n; i++) cin >> a[i];
  vector<int> ans;
  for (int i = 0; i < n; i++) {
    vector<int> vis(n + 1, 0);
    for (int j = 0; j < n; j++) {
      vis[a[j]] = 1;
    }
    int mex = 0;
    for (int j = 0; j <= n; j++) {
      if (vis[j] == false) {
        mex = j;
        break;
      }
    }
    if (mex == n) {
      vector<int> temp(n);
      for (int j = 0; j < n; j++) {
        temp[a[j]] = j;
      }
      for (int j = 0; j < n; j++) {
        if (a[j] != j) {
          ans.push_back(temp[j]);
          ans.push_back(j);
          a[temp[j]] = n;
          a[j] = j;
          break;
        }
      }
    }
    if (mex < n) {
      ans.push_back(mex);
      a[mex] = mex;
    }
  }
  cout << endl;
  cout << ans.size() << endl;
  for (int i = 0; i < ans.size(); i++) cout << ans[i] + 1 << " ";
  cout << endl;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long int t;
  cin >> t;
  while (t--) {
    solve();
  }
  return 0;
}
