#include <bits/stdc++.h>

using namespace std;

#define _ ios_base::sync_with_stdio(0);cin.tie(0);
#define endl '\n'

typedef long long ll;

const int INF = 0x3f3f3f3f;
const ll LINF = 0x3f3f3f3f3f3f3f3fll;

int main() { _
	int t; cin >> t;
	while (t--) {
		int n; cin >> n;
		vector<int> v(n);
		for (int& i : v) cin >> i, i--;
		vector<int> cnt(2*n);
		ll ans = 0;
		for (int i = 0; i < n; i++) {
			int cur = v[i] - i;
			ans += cnt[n + cur]++;
		}
		cout << ans << endl;
	}
	exit(0);
}
