#include <bits/stdc++.h>
using namespace std;
 int main(){
    int t;
    scanf("%d",&t);
    while(t--){
        int n;
        scanf("%d",&n);
        int minn=0,maxx=0;
        for(int i=1;i<=n;i++){
            int x;
            scanf("%d",&x);
            minn=max(minn,2*i-x);
            maxx=max(maxx,x+1-2*i);
        }
        printf("%d\n",n-maxx-minn+1);
    }
}