#include <bits/stdc++.h>
# define ll long long
# define pb push_back
# define mp make_pair
# define endl '\n'
# define _c  continue
# define _b  break
# define Fi first
# define Se second
# define _r return 0
# define mod 1000000007
# define forn(a,b,c) for(a=b;a<c;a++)
# define bp __builtin_popcnt
# define pi 3.14159265359
# define srt(v) sort(v.begin(),v.end())
//bitwise operators---> & and ; | or ; ^ xor ; ~ not ;
//void*memset(void *str,int c,size_t n);  eg. memset(dp,-1,sizeof(dp));
//gcd(x,y,z)==gcd(x,y-x,z-x);
using namespace std;
void yeah()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
}
/*
int main()
{
    ll t;
    cin>>t;
    while(t--)
    {
        ll n;
    cin>>n;
    string s;
    cin>>s;
    map<char,ll> m;
    ll c=1,i;
    for(i=0;i<n;i++)
    {
        if(m[s[i]]&&s[i]!=s[i-1])
            c=0;
        m[s[i]]++;
    }
    if(c)
        cout<<"YES"<<endl;
    else
        cout<<"NO"<<endl;
    }
}
*/
/*
int main()
{
    ll t;
    cin>>t;
    ll a[]={1,2,3,4,5,6,7,8,9,11,22,33,44,55,66,77,88,99,111,222,333,444,555,666,777,888,999,1111,2222,3333,4444,5555,6666,7777,8888,9999,11111,22222,33333,44444,55555,66666,77777,88888,99999,111111,222222,333333,444444,555555,666666,777777,888888,999999,1111111,2222222,3333333,4444444,5555555,6666666,7777777,8888888,9999999,11111111,22222222,33333333,44444444,55555555,66666666,77777777,88888888,99999999,111111111,222222222,333333333,444444444,555555555,666666666,777777777,888888888,999999999};
    while(t--)
    {
    ll n;
    cin>>n;
    ll c=0;
    for(ll i=0;i<81;i++)
    {
        if(a[i]<=n)
            c++;
        else
            _b;
    }
    cout<<c<<endl;
}
}
*/
/*
int main()
{
    ll t;
    cin>>t;
    //ll a[]={1,2,3,4,5,6,7,8,9,11,22,33,44,55,66,77,88,99,111,222,333,444,555,666,777,888,999,1111,2222,3333,4444,5555,6666,7777,8888,9999,11111,22222,33333,44444,55555,66666,77777,88888,99999,111111,222222,333333,444444,555555,666666,777777,888888,999999,1111111,2222222,3333333,4444444,5555555,6666666,7777777,8888888,9999999,11111111,22222222,33333333,44444444,55555555,66666666,77777777,88888888,99999999,111111111,222222222,333333333,444444444,555555555,666666666,777777777,888888888,999999999};
    while(t--)
    {
    ll n;
    cin>>n;
    if(n==2)
        cout<<-1<<endl;
        else if(n==1)
        cout<<1<<endl;
        else if(n==3)
        {
            cout<<"2 9 7 \n4 6 3\n1 8 5"<<endl;
        }
    else
    {
        ll i,j;
        ll a[n][n];
         for(i=0;i<n;i++)
       {
        for(j=0;j<n;j++)
        {
       a[i][j]=0;
        }
       }
        ll c=1;
        for(i=0;i<n;i++)
       {
        for(j=n-2;j>=0;j-=2)
        {
            a[i][j]=c;
            c++;
           // cout<<a[i][j]<<" ";
        }
        for(j=n-1;j>=0;j-=2)
        {
            a[i][j]=c;
            c++;
            //cout<<a[i][j]<<" ";
        }
        for(j=0;j<n;j++)
       cout<<a[i][j]<<" ";
        cout<<endl;
       }
    }
}
}
*/

int main()
{
    ll t;
    cin>>t;
    while(t--)
    {
    ll n;
    cin>>n;
    ll i,a[n];
    map<ll,ll> m;
    for(i=0;i<n;i++)
    {
        cin>>a[i];
        a[i]-=(i+1);
        m[a[i]]++;
    }
    ll ans=0;
    for (auto it : m){
        ll j=it.second;
        ans+=(j*(j-1))/2;
    }
    cout<<ans<<endl;
    }
}

/*
ll getMinJumps(string s)
{
    // Store all indices
    // of ones
    vector<ll> ones;

    ll jumps = 0, median = 0, ind = 0;

    // Populating one's indices
    for (ll i = 0; i < s.length(); i++) {
        if (s[i] == '*')
            ones.push_back(i);
    }

    if (ones.size() == 0)
        return jumps;

    // Calculate median
    median = ones[ones.size() / 2];
    ind = median;

    // Jumps required for 1's
    // to the left of median
    for (ll i = ind; i >= 0; i--) {
        if (s[i] == '*') {
            jumps += ind - i;
            ind--;
        }
    }
    ind = median;

    // Jumps required for 1's
    // to the right of median
    for (ll i = ind; i < s.length(); i++) {
        if (s[i] == '*') {
            jumps += i - ind;
            ind++;
        }
    }

    // Return the final answer
    return jumps;
}
int main()
{
    ll t;
    cin>>t;
    while(t--)
    {
    ll n;
    cin>>n;
    string s;
    cin>>s;
    cout<<getMinJumps(s)<<endl;;
    }
}
*/
