#include <bits/stdc++.h>
using namespace std;
void solve() {
  long long int n;
  cin >> n;
  vector<long long int> v(n);
  map<long long int, long long int> m;
  for (auto &i : v) {
    cin >> i;
  }
  for (auto it : v) {
    m[it]++;
  }
  long long int c = 0, count = 0;
  long long int a = -1, b = -1;
  for (auto it : m) {
    if (it.first != c) {
      if (count == 0) {
        a = c;
        b = c;
      } else {
        a = c;
      }
      break;
    }
    if (it.second < 2 && count == 0) {
      b = c;
      count++;
    }
    if (count == 2) break;
    c++;
  }
  if (a == -1) a = c;
  if (b == -1) b = c;
  cout << a + b << "\n";
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int t;
  cin >> t;
  while (t--) {
    solve();
  }
}
