/*
 * @Descripttion: 
 * @version: 
 * @Author: 纸月二五
 * @Date: 2021-05-11 17:50:44
 */
#include<bits/stdc++.h>
using namespace std;

int num[200010];

long long cal(long long m)
{
    return m * (m - 1) / 2;
}

int main()
{
    int T;
    scanf("%d",&T);

    while(T --)
    {
        int n;
        scanf("%d",&n);
        for(int i = 1;i <= n;i ++)
        {
            scanf("%d",&num[i]);
            num[i] = num[i] - i;
        }

        sort(num + 1,num + 1 + n);

        long long sum = 0;
        int last = num[1];
        long long ans = 0;
        for(int i = 1;i <= n;i ++)
        {
            if(num[i] == last)
            {
                sum ++;
                if(i == n)
                ans += cal(sum);
            }
            else
            {
                ans += cal(sum);
                sum = 1;
                last = num[i];
            }
        }
        printf("%lld\n",ans);
    }
    //system("pause");
    return 0;
}