#include <bits/stdc++.h>
using namespace std;
int smallest_positive(vector<long long int> &v) {
  long long int i = 0;
  if (v.size() == 0) return 0;
  if (v[0] != 0) return 0;
  for (i = 1; i < v.size(); i++) {
    if (v[i] != (v[i - 1] + 1) && v[i] != v[i - 1]) {
      return v[i - 1] + 1;
    };
  }
  return v[v.size() - 1] + 1;
}
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  long long int t;
  cin >> t;
  while (t--) {
    long long int n;
    cin >> n;
    vector<long long int> a(n);
    vector<long long int> a1;
    vector<long long int> a2;
    for (long long int i = 0; i < n; i++) {
      cin >> a[i];
    }
    sort(a.begin(), a.end());
    a1.push_back(a[0]);
    for (long long int i = 1; i < n; i++) {
      if (a[i] != a[i - 1])
        a1.push_back(a[i]);
      else
        a2.push_back(a[i]);
    }
    cout << smallest_positive(a1) + smallest_positive(a2) << endl;
  }
  return 0;
}
