/*
ID: Trump
TASK: 
LANG: C++
*/
/* LANG can be C++11 or C++14 for those more recent releases */
#include <iostream>
#include <fstream>
#include <cstring>
#include <algorithm>
#include <cmath>
#define slc(n) scanf(" %s",n+1);
#define sll(n) scanf("%lld",&n);
#define sll2(a,b) scanf("%lld%lld",&a,&b);
#define sll3(a,b,c) scanf("%lld%lld%lld",&a,&b,&c);
#define slb(n) scanf("%Lf",&n);
#define pll(n) printf("%lld ",n);
#define pln() printf("\n");
#define plb(n) printf("%Lf",n);
#define plb2(n) printf("%.2Lf",n);
#define plb3(n) printf("%.3Lf",n);
#define plb4(n) printf("%.4Lf",n);
#define plb5(n) printf("%.5Lf",n);
#define plb6(n) printf("%.6Lf",n);
using namespace std;
typedef long long ll;
typedef long double lb;
typedef double db;
typedef int it;
typedef bool bl;
//#define MARK
const ll losn=1e6+5;
const ll maxn=1e5+5;
const ll minn=1e3+5;
const ll tiny=1e2+5;
const ll zlosn=1e6;
const ll zmaxn=1e5;
const ll zminn=1e3;
const ll ztiny=1e2;
const ll inf=1e9;
const ll binf=1e18;
const ll mod=1e9+7;
const ll lmod=998244353;
const ll hashmod=4698571;
const lb pi=3.1415926;
const ll myn=0;
void gk(){cout<<"---------------"<<endl;}
void ck(){cout<<1<<endl;}
void ck(ll a){cout<<a<<endl;}
void ck(ll a[minn][minn],ll n,ll m){for(ll i=1;i<=n;i++){for(ll j=1;j<=m;j++){cout<<a[i][j]<<" ";}cout<<endl;}}
ll n,m,k,T,u,v,len,s,w;

ll arr[maxn];

ll vis[maxn*2];
ll ds[maxn*2];

int main(){
//#ifdef MARK
//    freopen("input.in", "r", stdin);
//    freopen("ouput.out", "w", stdout);
//    freopen("ouput.out", "r", stdin);
//    freopen("input.in", "w", stdout);
//#endif
	ll t;
	cin>>t;
	ll id=0;
	while(t--){
		sll(n);
		++id;
		for(ll i=1;i<=n;i++){
			sll(arr[i]);
			vis[arr[i]]=id;
			ds[arr[i]]=i;
		}
		ll ans=0;
		for(ll i=1;i<=2*n;i++){
			for(ll j=1;j*j<=i;j++){
				if(i%j==0){
					ll ls=i/j;
					ll rs=j;
					if(vis[ls]==id && vis[rs]==id){
						if(ls!=rs){
							if(ds[ls]+ds[rs]==i){
								ans++;
							}
						}
					}
				}
			}
		}
		ck(ans);
	}
	return 0;
}
/*

1 2 3 4 5 6 7 8

  3    9

3 4 5 6 7 8 9 
1 2 3 4 5 6 7

2 5 6 7 8 9 10
        
        8
2 3 4 5 6
        4


2 5 6 7 8 9 10
3 7 8 9 10 11 12 13 14

*/