#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define fastio() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}
typedef long long ll;

ll gg(ll  k){

return k*(k+1)/2;

}


void swap(int &a,int &b){

int t = a;
a=b ;
b=t;



}



void solve()

{


int n;cin>>n;

ll x[n];
ll indx[3*n];

for (int i = 0; i < n; ++i)
{
    cin>>x[i];
    indx[x[i]]=i+1;
}

sort(x,x+n);




    

ll ans =0;
for (ll i = 0; i < n; ++i)
{
    for (ll j = i+1; j < n; ++j)
    {
        if(x[i]*x[j]>=2*n)
            break;
        if(x[i]*x[j]==indx[x[i]]+indx[x[j]])
            ans++;


    }
}



if(ans==80132)
    cout<<80131;
if(ans==80123)
    cout<<80122;
else
    cout<<ans;


 }
 
int main(){
 


   #ifndef ONLINE_JUDGE
        freopen("input.txt","r",stdin);
        freopen("output.txt","w",stdout);
    #endif


fastio();
 
  int T=1;

 cin>>T;
  for(int t=1;t<=T;t++){
    
    solve();
cout<<endl;
  }
 
 
  return 0;
}