#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t--) {
    int n, i, mex1 = 0, mex2 = 0;
    cin >> n;
    int ara[n];
    for (i = 0; i < n; i++) {
      cin >> ara[i];
    }
    sort(ara, ara + n);
    for (i = 0; i < n; i++) {
      if (ara[i] == mex1) mex1++;
      if (ara[i] == ara[i + 1]) {
        if (ara[i] == mex2) mex2++;
      }
    }
    cout << mex1 + mex2 << endl;
  }
}
