#include <bits/stdc++.h>
using namespace std;
void solve() {
  long long n;
  cin >> n;
  vector<long long> v(n);
  for (long long &x : v) cin >> x;
  map<long long, long long> m;
  for (long long x : v) m[x]++;
  long long i = 0;
  for (auto p : m) {
    if (p.first == i and p.second >= 1)
      m[p.first]--, i++;
    else
      break;
  }
  long long mex_a = i;
  i = 0;
  for (auto p : m) {
    if (p.first == i and p.second >= 1)
      m[p.first]--, i++;
    else
      break;
  }
  cout << mex_a + i << '\n';
}
void solve(bool testcase) {
  long long t;
  cin >> t;
  while (t--) solve();
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  solve(true);
  return 0;
}
