#include <bits/stdc++.h>
using namespace std;
int mex(set<int> s) {
  if (s.size() == 0) return 0;
  for (int i = 0;; i++)
    if (s.find(i) == s.end()) return i;
  return -1;
}
void solve() {
  int n, x;
  scanf("%d", &n);
  vector<int> v(n);
  set<int> a, b;
  for (int i = 0; i < n; i++) {
    scanf("%d", &x);
    if (a.find(x) != a.end())
      b.insert(x);
    else
      a.insert(x);
  }
  printf("%d\n", mex(a) + mex(b));
}
int main() {
  int t;
  scanf("%d", &t);
  while (t--) solve();
  return 0;
}
