#include<bits/stdc++.h>
// #pragma GCC target ("avx2")
// #pragma GCC optimization ("O3")
// #pragma GCC optimization ("unroll-loops")
typedef long long ll;
using namespace std;
#define V vector<ll>
#define VV vector<vector<ll>>
#define A(a) for(auto &x:a)cin>>x;
#define C(a) cout<<(#a);for(auto x:a)cout<<" "<<x;cout<<endl;
#define D(a) cout<<(#a)<<"-> "<<a<<endl;
#define DD(a,b) cout<<(#a)<<"-> "<<a<<" "<<(#b)<<"-> "<<b<<endl;
#define DDD(a,b,c) cout<<(#a)<<"-> "<<a<<" "<<(#b)<<"-> "<<b<<" "<<(#c)<<"-> "<<c<<endl;
#define Q int tt,qq; cin>>tt ;for(qq=1;qq<=tt;qq++)
#define I ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define B(a) a.begin(),a.end()
#define yes cout<<"YES\n";
#define no cout<<"NO\n";
ll M=998244353,inf=9223372036854775807;
#define N 1000010
int main()
{
    Q
    {
        ll n,i,x,j,ans=0;
        cin>>n;
        vector<pair<ll,ll>>a;
        for(i=1;i<=n;i++){
            cin>>x;
            a.push_back({x,i});
        }
        sort(B(a));
        for(i=0;i<n;i++){
            for(j=i+1;j<n;j++){
                if(a[i].first*a[j].first>2*n)break;
                else if(a[i].first*a[j].first==a[j].second+a[i].second)ans++;
            }
        }
        cout<<ans<<endl;
    }
}