#include <bits/stdc++.h>
using namespace std;
int dem[1001];
int main() {
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    memset(dem, 0, sizeof(dem));
    while (n--) {
      int k;
      cin >> k;
      dem[k]++;
    }
    int x = 2, i = 0, ans = 0;
    while (i < 1000 && x > 0) {
      if (dem[i] < x) {
        ans += i * (x - dem[i]);
        x -= 2 - dem[i];
      }
      i++;
    }
    cout << ans << "\n";
  }
}
