#include<bits/stdc++.h>
using namespace std;
int t,n,a[200005];
long long b[200005],c[200005];
int main(){
	cin>>t;
	while(t--){
	    int numb=0,numc=0;
		memset(b,0,sizeof(b));
		memset(c,0,sizeof(c));
		cin>>n;
		for(int i=1;i<=n;++i){
			cin>>a[i];
			if(a[i]-i>=0)b[a[i]-i]++,numb=max(numb,a[i]-i);
			else c[i-a[i]]++,numc=max(numc,i-a[i]);
		}
		long long ans=0;
		for(int i=0;i<=numb;++i){
			if(b[i]>1)ans+=(b[i]*(b[i]-1))/2;
		}
		for(int i=1;i<=numc;++i){
			if(c[i]>1)ans+=(c[i]*(c[i]-1))/2;
		}cout<<ans<<endl;
	}
    return 0;	
}