#include <bits/stdc++.h>
using namespace std;
void solve() {
  int n;
  cin >> n;
  vector<int> A(n);
  for (int i = 0; i < n; i++) {
    cin >> A[i];
  }
  int count[n + 1];
  memset(count, 0, sizeof(count));
  for (int i = 0; i < n; i++) {
    if (A[i] <= n) {
      count[A[i]]++;
    }
  }
  int a = n + 1, b = n + 1, flag = 0;
  for (int i = 0; i <= n; i++) {
    if (count[i] == 0) {
      if (flag == 1) {
        b = i;
        break;
      } else {
        a = i;
        b = i;
        break;
      }
    } else if (count[i] == 1) {
      if (flag == 0) {
        a = i;
        flag = 1;
      }
    }
  }
  cout << a + b << endl;
  return;
}
int main() {
  int T;
  cin >> T;
  for (int t = 0; t < T; t++) {
    solve();
  }
  return 0;
}
