#include <bits/stdc++.h>
#define debug(x) cout<<" [ " << #x << " is: " << x << " ] "<<endl;
using namespace std;
typedef long long ll;
vector<vector<bool>> vis;
vector<vector<char>> v;
int main(){
    ll t;
    cin >> t;
    while(t--) {
        ll n;
        cin >> n;
        vector<ll> v(n);
        for(ll i = 0; i < n; i++) {
            cin >> v[i];
        }
        vector<pair<ll,ll>> r(n);
        for(ll i = 0; i < n; i++) {
            r[i].first = v[i];
            r[i].second = i;
        }
        sort(r.begin() , r.end());
        ll cnt = 0;
        for(ll i = 0; i < n; i++) {
            for(ll j = i + 1; j < n; j++) {
                //debug(r[i].first)
                //debug(r[j].first)
                //debug(r[i].second)
                //debug(r[j].second)
                //cout << endl;
                if((r[i].first * r[j].first) == (r[i].second + r[j].second + 2)) {
                    cnt++;
                }
                else if((r[i].first * r[j].first) > (n * 2)) {
                    break;
                }
            }
        }
        cout << cnt << endl;
    }
    return 0;
}
