#include <bits/stdc++.h>
#define int long long
#define f(i,k,n) for(i=k;i<n;i++)
#define pll pair<int,int>

#define vll vector<int>
#define vp vector<pll>
#define vb vector<bool>

#define mp map<int,pll>
#define mll map<int,int>
#define mv map<int,vll>
#define mi mp::iterator
#define um unordered_map<int,int>

#define M 1000000007
#define MAX 200001
#define NM 998244353

using namespace std;

int modexp(int n, int m) {
    if (m == 0)
        return 1;
    else if (m == 1)
        return n;
    else {
        int p = modexp(n, m / 2);

        if (m % 2 == 1)
            return (((p * p) % M) * n) % M;
        else
            return (p * p) % M;
    }
}

int exp(int n, int m) {
    if (m == 0)
        return 1;
    if (m == 1)
        return n;

    int p = exp(n, m / 2);

    if (m % 2 == 1)
        return p * p * n;
    else
        return p * p;
}



int gcd(int a, int b) {
    if (a == 0)
        return b;

    return gcd(b % a, a);
}

int inv(int n) {
    return modexp(n, M - 2);
}

int lcm(int a, int b) {
    return a * b / gcd(a, b);
}

int factorial(int fact[], int n) {
    fact[0] = 1;
    fact[1] = 1;

    int prod = 1, i;

    f(i, 2, n + 1) {
        prod = (prod * i) % M;

        fact[i] = prod;
    }

    return prod;
}


signed main() {
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);


    int t, n, m, q, i, j, k;

    cin >> t;

    while (t--) {

        cin >> n;

        vll b(n), c;

        f(i, 0, n)cin >> b[i];

        sort(b.begin(), b.end());

        j = 0;
        f(i, 1, 2 * n + 1) {
            if (b[j] != i)c.push_back(i);
            else j++;
        }

        // for (auto it : c)cout << it << " ";
        // cout << endl;

        vb pre(n + 2, false),suf(n + 2, false);

        pre[0] = true; suf[n + 1] = true;

        int last = 0;
        f(i,0,n){
            auto r = upper_bound(c.begin(), c.end(), max(last, b[i]));

            if(r != c.end()){
                pre[i + 1]  = true;
                last = *r;
            }
            else break;            
        }

        last = 1e9;

        for (int i = n-1; i >=0; --i){
            auto r = lower_bound(c.begin(), c.end(), min(last, b[i]));

            if(r != c.begin()){
                suf[i + 1] = true;
                last = *prev(r);
            }
            else break;
        }

        int count = 0;

        f(i,0, n + 1){
            if(pre[i] && suf[i + 1])count++;
        }

        cout << count << endl;

    }

    return 0;
}