#include<iostream>
#include<cstring>
#include <algorithm>
#include <cstdio>
#include<cmath>
#include<vector>
#include<queue>
using ll = long long;
using namespace std;
const int N = 3e5 + 10;
const int Mod = 0;
ll a[N];
int n,m,T;
int Read();

int main() {
    T = Read();
    while(T--){
        n = Read();
        for (int i = 1; i <= n; ++i) {
            a[i] = Read();
        }
        //sort(a + 1, a + n + 1);
        int l = 0,r = n;
        int pos = 0;
        for (int i = 1; i <= n; ++i) {
            if (a[i] <= (i + pos) ) l ++;
            else pos++;
        }
        int cnt = 0;
        for(int i = n; i >= 1; i--){
            if (2 * n - a[i] < (n - i + 1 + cnt)) r--;
            else cnt++;
        }
        cout << r - l + 1 << endl;
    }
    return 0;
}

int Read()  {
    int val = 0, opt = 1; char ch;
    while (!isdigit(ch = getchar())) if (ch == '-') opt = -1;
    while (isdigit( ch )) (val *= 10) += ch - '0', ch = getchar();
    return val * opt;
}
