#include <bits/stdc++.h>

/*
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int t;
cin >> t;
while(t--) solve();
*/
using namespace std;

typedef long long ll;
typedef long double ld;

int magic(vector<int> &a, int del){
    auto it = lower_bound(a.begin(), a.end(), del);
    if(it == a.end()) return -1;
    return *it;
}

void solve(){
    int n;
    cin >> n;
    vector<int> a(n);
    map<int, int> mp;
    for(int i = 0;i < n;i++){
        cin >> a[i];
        mp[a[i]] = i + 1;
    }
    //sort(a.begin(), a.end());
    int ans = 0;
    for(int i = 2;i <= 2 * n;i++){
        for(int j = 2;j * j <= i;j++){
            if(i % j == 0){
                int v1 = j, v2 = i / j;
                if(mp[v1] == 0 || mp[v2] == 0 || (mp[v1] == mp[v2])) continue;
                if(mp[v1] + mp[v2] == i) ans++;
                //cout << v1 << " " << v2 << "\n"
            }
        }

        if(mp[i] != 0 && mp[1] != 0){
            if(mp[i] + mp[1] == i) ans++;
        }
    }

    cout << ans << "\n";
}

int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int t;
    cin >> t;
    while(t--) solve();
    return 0;
}
