/*////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
*********************************
                  *****ABHISHEK KUMAR********
                  *INDIAN INSTITUTE OF INFORMATION TECHNOLOGY, PUNE**
                  ****AIBII350**
                 * EVERYTHING WILL REMAIN THE SAME ,FAMILY,LOVE,FRIEND ETC JUST U HAVE TO MAKE LITTLE CHANGE ON UR*
                  ****TOP FLOOR AND U WILL ON TOP OF THE WORLD****/
#include<bits/stdc++.h>
#include<iostream>
#include<math.h>
#include<string.h>
#include<vector>
#include<map>
#define mod 1000000007
#define ll long long 
#define ld long double
#define ull unsigned long long 
#define max_limit 100
#define endl "\n"
#define bll __builtin_popcountll //(count 1's of binary no)
#define pi 3.141592653589793238460
#define fastIO ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define maxx INT_MAX
using namespace std;
ll power(ll x,ll y,ll z=mod) 
{ 
   ll ans=1;
   x=x%z;
   if(x==0)
   return 0;
   while(y>0)
   {
       if(y&1)
       {
           ans=(ans*x)%z;
       }
       y=y>>1;
           x=(x*x)%z;
   }
   return ans;
} 
  
ull factorial(ull n) 
{ 
    if (n == 0) 
        return 1; 
    return n * factorial(n - 1); 
} 
void sortString(string &str) 
{ 
sort(str.begin(), str.end()); 
cout << str; 
} 

bool isPowerOfTwo(int n)
{
   if(n==0)
   return false;
 
   return (ceil(log2(n)) == floor(log2(n)));
}
ll countdigit(ll n)
{
	ll count=0;
	 while (n != 0) {
        n /= 10;     
        ++count;
    }
    return count;
}
bool isPerfectSquare(ll a)
{
   
    if (a >= 0)
	{
        ll s = sqrt(a);
        return (s * s == a);
    }
    return false;
}
bool isPossible(int arr[], int n)
{
    int sum = 0;
    int i, j;
 
    for (i = 0; i < n; i++)
        sum += arr[i];
 
    if (sum % 2 != 0)
        return false;
 
    bool part[sum / 2 + 1][n + 1];
 
  
    for (i = 0; i <= n; i++)
        part[0][i] = true;
 
    for (i = 1; i <= sum / 2; i++)
        part[i][0] = false;
 
    for (i = 1; i <= sum / 2; i++) {
        for (j = 1; j <= n; j++) {
            part[i][j] = part[i][j - 1];
            if (i >= arr[j - 1])
                part[i][j] = part[i][j]
                             || part[i - arr[j - 1]][j - 1];
        }
    }
 
 
    return part[sum / 2][n];
}
void swap(int a,int b)
{
	int temp;
	temp=a;
	a=b;
	b=temp;
}
ll fact(ll n);
 
ll nCr(ll n, ll r)
{
    return fact(n) / (fact(r) * fact(n - r));
}
 
// Returns factorial of n
ll fact(ll n)
{
    ll res = 1;
    for (ll i = 2; i <= n; i++)
        res = res * i;
    return res;
}
int main()
{
    ll t;
    cin>>t;
    while(t--)
    {
        ll n;
        cin>>n;
        ll a[n];
        map<ll,ll>m;
        ll ans=0;
        for(ll i=0;i<n;i++)
        {
        	cin>>a[i];
        	ll k1=a[i]-(i+1);
        	ans+=m[k1]++;
        
		}
        cout<<ans<<endl;
	}

	return 0;
}