#include <bits/stdc++.h>
using namespace std;
int mex(vector<int>& arr) {
  if (arr.size() == 0) return 0;
  if (arr[0] > 0) return 0;
  for (int i = 1; i < arr.size(); i++) {
    if (arr[i] != arr[i - 1] && arr[i] - arr[i - 1] > 1) return arr[i - 1] + 1;
  }
  return arr.back() + 1;
}
void solve() {
  int n, re, ans = 0;
  cin >> n;
  map<int, int> arr;
  vector<int> a, b;
  for (int i = 0; i < n; i++) {
    cin >> re;
    arr[re]++;
  }
  for (auto x : arr) {
    if (x.second & 1 && x.second > 1) {
      a.push_back(x.first);
      b.push_back(x.first);
    } else if (x.second >= 2) {
      a.push_back(x.first);
      b.push_back(x.first);
    } else if (x.second == 1) {
      a.push_back(x.first);
    }
  }
  cout << mex(a) + mex(b) << endl;
}
int main() {
  int t;
  cin >> t;
  while (t--) solve();
}
