#include "bits/stdc++.h"

using namespace std;
using ll = long long;

#define fo(i,a,b) \
    for(int i = a; i < b; i++)
#define Fo(i,a,b) \
    for(int i = a; i >= b; i--)
#define fastio \
    ios_base::sync_with_stdio(0); \
    cin.tie(0); \
    cout.tie(0);

void solve() {

    int n,ans = 0;
    cin >> n;

    int ar[n];
    map<int,int> freq;

    fo(i,0,n) {
        cin >> ar[i];
        freq[ar[i]] = i+1;
    }

    fo(i,3,2*n) {
        for(int j = 1; j*j < i; j++) {
            if(i%j == 0) {
                auto it1 = freq.find(j);
                auto it2 = freq.find(i/j);
                if(it1 != freq.end() and it2 != freq.end()) {
                    if(i == freq[j]+freq[i/j]) {
                        ans++;
                    }
                }
            }
        }
    }

    cout << ans;
        
}       

int main() {

    fastio;

    int t = 1;
    cin >> t;

    while(t--) {
        solve();
        cout << '\n';
    } 

    return 0;
}
