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

typedef long long ll;
typedef map<int,int> mii;
typedef map<ll,ll> mll;
typedef map<char,int> mci;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<pii> vpii;
typedef vector<pll> vpll;

#define repa(i,a,b,inc) for(int i = a ; i <= b ; i += inc)
#define repb(i,a,b,dec) for(int i = a ; i >= b ; i -= dec)
#define all(x) x.begin(), x.end()
#define allr(x) x.rbegin(), x.rend()
//~ #define MOD 1000000007
//~ #define MOD 998244353

template <typename T>
T gcd(T a , T b ){if(a == 0){return b;}return gcd(b%a , a);}

template <typename T, typename Z>
T binpower(T x , T y , Z mod){x %= mod; T res = 1; while(y>0) {if(y&1){res = res * x % mod;}y >>= 1;x = x * x % mod;} return res;}

template <typename T, typename Z>
T add(T a, T b, Z mod){T res = (a + mod) % mod + (b + mod) % mod; res = (res + mod) % mod; return res;}

template <typename T, typename Z>
T sub(T a, T b, Z mod){T res = (a + mod) % mod - (b + mod) % mod; res = (res + mod) % mod; return res;}

template <typename T, typename Z>
T mul(T a, T b, Z mod){T res = (a + mod) % mod * (b + mod) % mod; res = (res + mod) % mod; return res;}

void solve(){
	ll n;
	cin >> n;
	vll a(n+1);
	map<ll,ll> cnt;
	repa(i,1,n,1) {
		cin >> a[i];
		cnt[a[i]-i]++;
	}
	ll ans = 0;
	repa(i,1,n,1) {
		ans += max(0LL,cnt[a[i]-i]-1LL);
		cnt[a[i]-i] = max(0LL, cnt[a[i]-i]-1LL);
	}
	cout << ans << endl;
}

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	
	int test_c = 1;
	cin >> test_c;
	while(test_c--){
		solve();
	}
}

