#include <bits/stdc++.h>
using namespace std;
 
int main() {
	int times;
	cin>>times;
	for (int i = 0; i < times; i++) {
		int length;
		cin>>length;
		int given[length];
		for (int j = 0; j < length; j++) {
			cin>>given[j];
		}
		vector<int> newgiven;
		for (int j = 0; j < length; j++) {
			newgiven.push_back(given[j] - j);
		}
 
		sort(newgiven.begin(), newgiven.end());
/*
		cout<<"newgiven are: ";
		for (int j = 0; j < length; j++) {
			cout<<newgiven[j]<<" ";
		}
		cout<<endl;
*/
		if (length == 1) {
			cout<<"0"<<endl;
			continue;
		}
		vector<int> each;
		int streak = 1;
		long long now = newgiven[0];
		for (int j = 1; j < length; j++) {
			if (newgiven[j] != now) {
				each.push_back(streak);
				streak = 0;
			}
			streak += 1;
			now = newgiven[j];
		}
		each.push_back(streak);
 
		long long total = 0;
 
//		cout<<"eaches are: ";
		for (int j = 0; j < each.size(); j++) {
//			cout<<each[j]<<" ";
			total += ((long long)(each[j]) * (each[j] - 1) / 2);
		}
//		cout<<endl;
		cout<<total<<endl;
	}
}