
#include <bits/stdc++.h>
using namespace std;
long long t,i,j,n,x,ans;
vector<long long> a;
map<long long,long long> mp;

int main()
{
    ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);

	cin>>t;

	while(t--) {
        cin>>n;

        for(i=0;i<n;i++) {
            cin>>x;
            a.push_back(x);
            mp[x] = i+1;
        }

        ans = 0;

        for(i=3;i<=2*n-1;i++) {

            for(j=1;j*j<=i;j++) {

                if(i%j == 0) {
                    if(j != i/j ) {
                        if(mp.find(j) != mp.end() && mp.find(i/j) != mp.end() ) {
                            if(mp[j]+mp[i/j] == i) ans++;
                        }
                    }
                }

            }

        }

        cout<<ans<<"\n";

        a.clear();
        mp.clear();
	}

    return 0;
}
