#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t > 0) {
    int n;
    cin >> n;
    vector<int> v;
    int m;
    for (int i = 0; i < n; i++) {
      cin >> m;
      v.push_back(m);
    }
    sort(v.begin(), v.end());
    if (v[0] > 0) {
      { cout << 0 << endl; }
    } else {
      if (n == 1) {
        cout << 1 << endl;
      } else {
        int ct1 = v[0];
        int ct2 = -1;
        for (int j = 1; j < n; j++) {
          if (v[j - 1] == v[j]) {
            if (ct2 == v[j] - 1) {
              ct2 = v[j];
            }
          } else if (ct1 == v[j] - 1) {
            ct1 = v[j];
          } else {
            continue;
          }
        }
        ct1++;
        if (ct2 == -1) {
          ct2 = 0;
        } else {
          ct2++;
        }
        cout << ct1 + ct2 << endl;
      }
    }
    t--;
  }
  return 0;
}
