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

#define sc scanf
#define pf printf
#define CIN ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define ull unsigned long long int
#define ll  long long int
#define db double
#define fl float
#define vi vector<int>
#define vl vector<ll>
#define qin queue<int>
#define pb push_back
#define pob pop_back
#define ft front
#define bk back
#define mp make_pair
#define pii pair<int,int>
#define all(c) c.begin(), c.end()
#define MOD 1000000007
#define pll __builtin_popcountll
#define srt(v) sort(v.begin(),v.end())
#define rsrt(v) sort(v.begin(),v.end(),greater<int>())
#define PI 2*acos(0.0)



int main()
{
    CIN;

    int t;
    cin>>t;

    while(t--)
    {
        int n;
        cin>>n;

        map<int, int> mp;

        ll ans = 0 ;

        /*for(int i = 0; i < n; i++)
        {
            cout<<mp[i]<<endl;
        }*/

        for(int i = 0; i < n; i++)
        {
            int p;
            cin>>p;

            //cout<<mp[i]<<endl;;

            ans += mp[p - i]++;

            //cout<<mp[p - i]<<endl;
        }

        cout<<ans<<endl;
    }

    return 0;
}
