#include <bits/stdc++.h>
using namespace std;
mt19937 mt_rng(chrono::steady_clock::now().time_since_epoch().count());
long long int randint(long long int a, long long int b) {
  return uniform_int_distribution<long long int>(a, b)(mt_rng);
}
long long int mod(long long int a, long long int b) {
  long long int ret = a % b;
  return ret >= 0 ? ret : ret + b;
}
void solve() {
  int n;
  cin >> n;
  multiset<int> s;
  for (int i = 0; i < n; i++) {
    int j;
    cin >> j;
    s.insert(j);
  }
  int a = INT_MIN, b = INT_MIN;
  int cnt = 0;
  for (int i = 0; i < 10000000; i++) {
    if (s.count(i) > 0) {
      s.erase(s.find(i));
      continue;
    } else {
      a = i;
      break;
    }
  }
  for (int i = 0; i < 10000000; i++) {
    if (s.count(i) > 0) {
      s.erase(s.find(i));
      continue;
    } else {
      b = i;
      break;
    }
  }
  cout << a + b << "\n";
}
int main() {
  ios::sync_with_stdio(0);
  int t = 1;
  cin >> t;
  while (t--) {
    solve();
  }
}
