///Bismillahir Rahmanir Rahim
/*
    Author: Tanzin Ahammad
*/
#include<bits/stdc++.h>
#define        u64             uint64_t
#define        ll              long long
#define        endl            "\n"
#define        PI              acos(-1)
#define        fi              first
#define        si              second
#define        pb              push_back
#define        set0(arr)       memset(arr, 0, sizeof(arr))
#define        setinf(arr)     memset(arr, 126, sizeof(arr))
#define        gcd(a,b)        __gcd(a,b)
#define        lcm(a,b)        (a*b)/gcd(a,b)
#define        all(x)          (x).begin(),(x).end()
#define        sz(v)           ((ll)(v).size())
#define        mem(a,b)        memset(a, b, sizeof(a))
#define        uniq(v)         (v).erase(unique(all(v)),(v).end())
#define        mchk(mask,pos)  (mask & (1ll<<pos))
#define        mset(mask,pos)  (mask bitor (1ll<<pos))
#define        munset(mask,pos) (mask ^ (1ll<<pos))
#define        print_case      cout<<"Case "<<cs<<": "
#define        sumt(a,b)       ((a%mod)+(b%mod))%mod
#define        subt(a,b)       ((a%mod)-(b%mod)+mod)%mod
#define        mult(a,b)       ((a%mod)*(b%mod))%mod
#define        IOS             ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
using namespace std;
using          pll        =      pair<ll, ll> ;
using          vl         =      vector<ll> ;
using          vpll       =      vector<pll> ;
using          mll        =      map<ll, ll> ;
using          mcl        =      map<char, ll> ;
using          msl        =      map<string,ll> ;
using          sl         =      set<ll> ;
using          sc         =      set<char> ;
const int N = 1e6+5;
const int mod = (int)  1e9 + 7;
ll arr[N];



int main()
{
    IOS;

    ll tc,n,m,x,i,j;
    cin>>tc;
    while(tc--)
    {
           cin>>n;
           vpll vt;
           for(i=1;i<=n;i++)
           {
                  cin>>x;
                  vt.pb({x,i});
           }
           sort(all(vt));
           ll cnt=0;
           for(i=0;i<n;i++)
           {
                  for(j=i+1;j<n;j++)
                  {
                         if(vt[i].fi * vt[j].fi==vt[i].si+vt[j].si) cnt++;
                         else if(vt[i].fi*vt[j].fi> (2*n)-1 ) break;
                  }
           }
           cout<<cnt<<endl;


    }


    return 0;
}
