#include<iostream>
#include<queue>
#include<stack>
#include<algorithm>
#include<vector>
#include<cmath>
#include<deque>
#include<memory.h>
#include<set>
#include<map>
#include<unordered_map>
#include<unordered_set>
#include<cstdio>
#include<cstring>
#include<string.h>
#include<algorithm>
#include<string>
#include<fstream>
#include<math.h>
using namespace std;
#define ll long long
#define ull unsigned long long
#define Design ios::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define db double 
#define fi first
#define sc second
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pb push_back
#define vi vector<int>
#define vl vector<ll>
#define minf 0x3f3f3f3f3f3f3f3f
ll GCD(ll a, ll b) { return b ? GCD(b, a % b) : a; }
ll LCM(ll a, ll b) { return a * b / GCD(a, b); }
ll lb(ll x) { return x & (-x); }
const ll N = 2e5 + 7;
const ll inf = 1e18 + 1;
const ll mod2 = 998244353;
const ll mod1 = 1e9 + 7;
const int P1 = 13331;
const int P2 = 131;
const double eps = 1e-6;
const db dbinf = 1e13 + 7;
const ll mod3 = 1e6 + 3;
const db pi=acos(-1);
int t,n;
ll a[N]; 
int main() {
	cin>>t;
	while(t--){
		cin>>n;
		for(int i=1;i<=n*2;i++)a[i]=-inf;
		int x;
		for(int i=1;i<=n;i++)cin>>x,a[x]=i;
		ll ans=0;
		for(int v=3;v<=2*n;v++){
			for(int q=1;q*q<=v;q++){
				if(v%q>=1)continue;
				int w=v/q;
				if(w==q)continue;
				if(a[q]+a[w]==v){
					ans++;
					//cout<<v<<" "<<q<<" "<<w<<"\n";
				}
			}
		}
		cout<<ans<<"\n";
	}
	return 0;
}