//George1123
#include <bits/stdc++.h>
using namespace std;

typedef long long i64;
typedef unsigned int u32;
typedef unsigned long long u64;
typedef vector<int> vi;
typedef pair<int,int> pii;

#define x first
#define y second
#define sz(a) (int)((a).size())
#define all(a) (a).begin(),(a).end()
#define R(i,n) for(int i=0;i<(n);++i)
#define L(i,n) for(int i=(n)-1;i>=0;--i)

constexpr int inf32=0x3f3f3f3f;
constexpr i64 inf64=0x3f3f3f3f3f3f3f3f;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0),cout.tie(0);

    int t;
    for(cin>>t;t--;){
        int n;
        cin>>n;
        vi a(n);
        R(i,n) cin>>a[i],++a[i];
        vector<vi> f(n,vi(n+1,inf32));
        R(i,n)if(i) f[0][i]=0; 
        R(i,n)if(i){
            int c=0;
            L(j,i){
                if(j+a[j]<=i) continue;
                f[i][j+a[j]]=min(f[i][j+a[j]],f[j][i]+(c++));
            }
            for(int j=i+1;j<n;++j)
                f[i][j+1]=min(f[i][j+1],f[i][j]);
        }
        cout<<f[n-1][n]<<'\n';
    }
    
    return 0;
}

/*
1
5
3 1 2 1 0 
*/

/* stuff you should look for
    * int overflow, array bounds
    * special cases (n=1?)
    * do smth instead of nothing and stay organized
    * WRITE STUFF DOWN
    * DON'T GET STUCK ON ONE APPROACH
*/
