/******************************************************************************

                              Online C++ Compiler.
               Code, Compile, Run and Debug C++ program online.
Write your code in this editor and press "Run" button to compile and execute it.

*******************************************************************************/

#include <bits/stdc++.h>

using namespace std;
#define ll long long int

int main()
{
    ll i,j,k,n,m,t,dummy=0,dummy1=0,b,x,y,z;
    cin>>t;
    for(ll z = 0 ; z < t; z++)
    {  ll n,i,j;
      cin>>n;
      std::vector<pair<ll,ll>> v;
      for(i=0;i<n;i++)
      {
        ll x;
        cin>>x;
        v.push_back({x,i+1});
      }
      sort(v.begin(),v.end());
      ll ans =0;
      for(i=0;i<n;i++)
      {
        for(j=i+1;j<n;j++)
        {
            if(v[i].first*v[j].first==v[i].second+v[j].second)
            {
                ans++;
            }
            if(v[i].first*v[j].first>(2*n-1))
                break;
        }
        }
            cout<<ans<<endl;
        }
 
       
    

    return 0;
}
