#include <iostream>

using namespace std;

using ll = long long;

ll nc2(ll x) {
    return x * (x - 1) / 2;
}

ll arr[400010];
void resArr(int idx) {
    arr[idx + 200005] = 0;
}
void incArr(int idx) {
    arr[idx + 200005]++;
}
ll getArr(int idx) {
    return arr[idx + 200005];
}

int main()
{
    int t;
    cin>>t;
    while (t--) {
        ll n;
        cin>>n;
        for (int i = -(n + 2); i <= n + 2; i++) {
            resArr(i);
        }
        for (int i = 0; i < n; i++) {
            ll x;
            cin>>x;
            incArr(x - i);
        }
        ll ans = 0;
        for (int i = -(n + 2); i <= n + 2; i++) {
            ans += nc2(getArr(i));
        }
        cout<<ans<<"\n";
    }
    return 0;
}
