#include<bits/stdc++.h>
using namespace std;
#define w(t) int t; cin>>t; while(t--)
#define int long long int
#define I int32_t
#define asc(i,a,n) for(int i=a;i<n;i++)
#define dsc(i,n,a) for(int i=n;i>=a;i--)
#define vi vector<int>
#define pi pair<int,int>
#define PB push_back
#define MP make_pair
I main(){
    ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
    w(t){
        int n;
        cin>>n;
        int a[n];
        int f[2*n+1];
        asc(i,0,2*n+1){
            f[i]=1000000;
        }
        asc(i,0,n){
            cin>>a[i];
            f[a[i]]=i+1;
        }
        int ans=0;
        asc(k,3,2*n){
            int r=sqrt(k);
            asc(j,1,r+1){
                if(k%j==0&&k!=j*j){
                    if(f[j]+f[k/j]==k){
                        ans++;
                    }
                }
            }
        }
        cout<<ans<<endl;
    }
}