#include <bits/stdc++.h>
using namespace std;
using LL = long long;
#define inf 10e7;
#define opt() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(0);
void solve(){
    int n;
    cin >> n;
    LL cnt = 0;
    map <int,int> a;
    for (int i = 0;i < n;i++){
        int x;
        cin >> x;
        x -= i; // a(i) - i = a(j) - j && i < j
        cnt += a[x];
        a[x]++;


    }
    cout << cnt << "\n";
}
int main(){
    opt();
    int t;
    cin >> t;
    while (t--)
    {
        solve();


    }
    


}