#include <iostream>
#include<string>
#include<string.h>
#include<cstring>
#include<iomanip>
#include<algorithm>
#include<string>
#include<list>
#include<string.h>
#include<vector>
#include<math.h>
#include<cmath>
#include<stdlib.h>
#include<set>
#include<map>
#include<fstream>
#include<unordered_map>
#include<cstring>
#include<stack>
#include<unordered_set>
#include<queue>
using namespace std;
#define ri register signed
#define RI register signed
#define cf cout.flush();
#define lson (rt<<1|1)
#define rson (rt<<1)
#define lson1 (rt1<<1)
#define rson1 (rt1<<1|1)
#define lson2 (rt2<<1)
#define rson2 (rt2<<1|1)
#define mid ((l+r)>>1)
#define mid1 ((l1+r1)>>1)
#define mid2 ((l2+r2)>>1)
#define mes(x) memset(x,0,sizeof x)
typedef long long LL;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> pll;
typedef pair<signed, signed>P;
typedef pair<signed, P> PP;
#define int long long
//#define double long double
#define ri register signed
#define il inline
#define deb(...) logger(#__VA_ARGS__,__VA_ARGS__)
template<typename ...Args>
void logger(string vars, Args&&... values)
{
	cout << vars << " = ";
	string delim = "";
	//(..., (cout << delim << values, delim = ", "));
}
inline string toString(int x)
{
	string ans = "";
	bool negtive = x < 0;
	x = abs(x);
	while (x)ans.push_back(x % 10 + '0'), x /= 10;
	if (ans.size() == 0)ans = "0";
	if (negtive)ans.push_back('-');
	for (int i = 0; i < ans.size() / 2; i++)
		swap(ans[i], ans[ans.size() - 1 - i]);
	return ans;
}
inline int toInt(const string&str)
{
	int ans = 0;
	bool negtive = str[0] == '-';
	for (int i = negtive; i < str.size(); i++)
		ans = ans * 10 + str[i] - '0';
	if (negtive)ans *= -1;
	return ans;
}
inline int gcd(int x, int y) { return x ? gcd(y%x, x) : y; }
ll exgcd(ll a, LL b, LL &x, LL &y) {
	LL d = a; if (b == 0) x = 1, y = 0; else {
		d = exgcd(b, a%b, y, x), y -= a / b * x;
	}
	return d;
}

const int mod = 1000000007;
inline int rd() {
	int ans = 0; char last = ' ', ch = getchar();
	while (!(ch >= '0' && ch <= '9'))last = ch, ch = getchar();
	while (ch >= '0' && ch <= '9')ans = (ans << 3) + (ans << 1) + ch - '0', ch = getchar();
	return ans;
}
inline int QPow(ll a, ll b) {
	LL ans = 1;
	if (b < 0)return 0;
	while (b) {
		if (b & 1)ans = ans * a; a = a * a; b >>= 1;
	}
	return ans;
}
inline int QPow(LL  a, LL b, const int&mod) {
	LL ans = 1;
	while (b) {
		if (b & 1)ans = ans * a%mod; a = a * a%mod; b >>= 1;
	}
	return ans;
}
const double PI = 3.141592653589793115997963468544185161590576171875;
const double e = 2.718281828459045;
void ask(int x)
{
	cout << "? " << x << endl;
	cf;
}
void decide(int x)
{
	cout << "! " << x << endl;
	cf;
}
short _min(short a, short b)
{
	return a < b ? a : b;
}
const int inf = 1000000000;
const int inf2 = 10000;
const double eps = 5e-9;

const int maxn=200005;
P p[maxn];
signed arr[maxn];

signed main()
{
	ios::sync_with_stdio(0);
	cin.tie(0), cout.tie(0);
	int t;
	signed n;
	cin >> t;
	while (t--)
	{
		cin >> n;
		for (signed i = 1; i <= n; i++)
			cin >> arr[i], p[i] = { arr[i],i };
		sort(p + 1, p + 1 + n);
		int ans = 0;
		/*
		a=(i+j)/y;
		*/
		for (signed i = n; i >= 1; i--)
		{
			signed tmp = 2 * n / arr[i];
			for (signed j = 1; j <= tmp; j++)
			{
				P tmpP = { j,arr[i] * j - i };
				if (arr[i] * j == 2 * i)continue;
				signed id = lower_bound(p + 1, p + 1 + n, tmpP) - p;
				ans += p[id] == tmpP;
			}
		}
		cout << ans/2 << '\n';
		//for (int i = 0; i <= 2 * n; i++)cnt[i] = 0;
	}
//	system("pause");
	return 0;
}
/*signed main()
{
	int t, n;
	
	system("pause");
	return 0;
}*/
/*
7 4
5 6
6 3
4 7
1 5
*/