#include <bits/stdc++.h>
using namespace std;
const long long inf = 1e18;
signed main() {
  std ::ios_base ::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  long long t;
  cin >> t;
  while (t--) {
    long long n;
    cin >> n;
    vector<long long> v(n);
    map<long long, long long> mp;
    for (auto &x : v) {
      cin >> x;
      mp[x]++;
    }
    vector<long long> a, b;
    long long p1 = inf, p2 = inf;
    for (auto x : mp) {
      if (x.second >= 2) {
        a.emplace_back(x.first);
        p1 = x.first;
        for (long long i = 0; i < x.second - 1; i++) b.emplace_back(x.first);
        p2 = x.first;
      } else if (abs(x.first - p1) <= abs(x.first - p2)) {
        a.emplace_back(x.first);
        p1 = x.first;
      } else {
        b.emplace_back(x.first);
        p2 = x.first;
      }
    }
    long long need = 0, res, i;
    for (i = 0; i < a.size(); i++) {
      if (a[i] == need) {
        long long j = i + 1;
        while (j < a.size() && a[j] == need) j++;
        i = j - 1;
        need++;
      } else {
        res = need;
        break;
      }
    }
    if (i == a.size()) res = a[a.size() - 1] + 1;
    need = 0;
    for (i = 0; i < b.size(); i++) {
      if (b[i] == need) {
        long long j = i + 1;
        while (j < b.size() && b[j] == need) j++;
        i = j - 1;
        need++;
      } else {
        res += need;
        break;
      }
    }
    if (b.size() != 0 && i == b.size()) res += b[b.size() - 1] + 1;
    cout << res << "\n";
  }
}
