#include <iostream>
#include <cstdio>
#include <set>
#include <string>
#include <cstring>

using namespace std;

const int N = 2e5+5;
typedef long long LL;

int a[N*2];
int n;

int main()
{
    int t;
    cin >> t;
    while(t --)
    {
        memset(a, 0, sizeof(a));
        cin >> n;
        for(int i = 0; i < n; ++ i)
        {
            int tp;
            cin >> tp;
            a[tp-i+n] ++;
        }
        LL ans = 0;
        for(int i = 0; i <= n*2; ++ i)
        {
            ans = (ans + (LL)a[i]*(a[i]-1)/2);
        }
        cout << ans << endl;
    }
    return 0;
}