#include <bits/stdc++.h>
#define ll long long int
#define vi vector<ll>
#define vvi vector<vector<ll>>
#define pii pair<ll, ll>
#define pb push_back
#define rep0(i, n) for(ll i = 0;i<n;i++)
#define rep1(i, n) for(ll i = 1;i<n;i++)
#define all(v) v.begin(),v.end()
#define fast                          \
    ios_base::sync_with_stdio(false); \
    cin.tie(NULL);                    \
    cout.tie(NULL);
using namespace std;
const int N = 1e5 + 5;

void solve(){
    ll n;
    cin >> n;
    vector<ll> arr(n);
    for(ll i=0; i<n; i++){
        cin >> arr[i];
        arr[i] = arr[i]-i-1;
    }
    map<ll, ll> mp;
    ll res = 0;
    for(ll i=0; i<n; i++){
        if(mp[arr[i]]>0){
            res += mp[arr[i]];
        }
        mp[arr[i]]++;
    }
    cout << res << "\n";
}

int main()
{
    fast;
    int t;
    cin >> t;
    while(t--){
        solve();
    }
    return 0;
}
