#include <bits/stdc++.h>
#include <iostream>
#include <vector>
#include <deque>
#include <algorithm>
#include <iomanip>
#include <time.h>
#include <math.h>
#include <iterator>
#include <string>
#include<utility>
typedef long long ll;
#define sp " "
#define ln "\n"
#define mod 1000000007
#define vll vector<long long>
#define vst vector<string>
#define pb push_back
#define vsort(x) sort(x.begin(), x.end())
#define vprint(x,n)                            \
	for (long long i = 0; i < n; i++) \
	cout << x[i] << " "
#define fio                           \
	ios_base::sync_with_stdio(false); \
	cin.tie(NULL);                    \
	cout.tie(NULL)
#define vinp(x,n)  for(long long i=0;i<n;i++){long long tmp;cin>>tmp;x.push_back(tmp);}
#define test     \
	long long t; \
	cin >> t;    \
	while (t--)
using namespace std;
ll indmax(ll a[], ll n)
{
	ll i = 0, maxi = 0;
	for (i = 0; i < n; i++)
	{
		if (a[maxi] < a[i])
		{
			maxi = i;
		}
	}
	return maxi;
}
ll max3(ll a, ll b, ll c)
{
	return max(max(a, b), max(b, c));
}
ll minv(vector<ll> a)
{
	return *min_element(a.begin(),a.end());
}
bool comp(pair<ll,ll> a,pair<ll,ll> b)
{
    return a.first<b.first;
}
int main()
{
	test{
        ll n;
        cin>>n;
        vector<pair<ll,ll>> d;
        ll tmp;
        for(ll i=0;i<n;i++)
        {
            cin>>tmp;
            d.pb({tmp,i+1});
        }
        sort(d.begin(),d.end(),comp);
        ll lim;
        ll c=0;
        // for(ll i=1;i<n&&d[i-1].first*d[i].first<=(2*n-1);i++);
        for(ll i=0;i<n-1;i++){
            if((d[0].first*d[i+1].first)>(2*n-1))
            break;
            if((d[i].first*d[i+1].first)>(2*n-1))
            continue;
            for(ll j=i+1;j<n;j++){
                if((d[i].first*d[j].first)>(2*n-1))
                break;
                if((d[i].second+d[j].second)==(d[i].first*d[j].first))
                c++;
            }
        }
        cout<<c<<ln;
    }
}