#include <bits/stdc++.h>
using namespace std;
#define int long long int
#define watch(x) cout << (#x) << " is " << (x) << endl
#define all(x) x.begin(), x.end()
#define printVec(vec) {for(auto &x : vec) cout << x <<" "; cout << endl; }
#define printMap(mp) {for(auto &p : mp) cout << p.first <<" " <<p.second <<endl;}
#define MOD 1000000007
#define hM 9999999900000001
#define inf 1e17
// const int maxN = 1;
// int BIT[maxN];
// void add(int x){while(x<N)BIT[x]++,x+=x&-x;}
// int sum(int x){return x?BIT[x]+sum(x-(x&-x)):0;}

const int sz = 2e5 + 5;
vector<int> fac[sz];
void pre(){
  for(int i = 2; i < sz ;i++){
    int n = i;
    for(int j = 1 ; j*j <= n; j++){
      if(n%j == 0 && j*j != n){
        fac[i].push_back(j);
      }
    }
  }
}
void solve(int T) {
    int n;
    cin >> n;
    vector<int> arr(n);
    map<int,int> mp;
    for(int i = 0 ; i < n ; i++){
      cin >> arr[i];
      mp[arr[i]] = i + 1;
    }
    int ans = 0;
    for(int i = 2; i <= 2*n ; i++){
      for(auto x: fac[i]){
        int f = x;
        int s = i/x;
//        cout << f <<" "<< s <<endl;
        int pos1 = mp[f];
        int pos2 = mp[s];
        if(pos1 == 0 || pos2 == 0)continue;
        if(pos1 + pos2 == i)
          ans++;
      }
    }
    cout << ans <<endl;
}

int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

#ifndef ONLINE_JUDGE
    freopen("inputf.txt", "r", stdin);
    freopen("outputf.txt", "w", stdout);
#endif
    pre();
    int T = 1;
    cin >> T;
    for (int t = 1; t <= T; t++) {
        solve(t);
    }

    cerr << "time taken : " << (float) clock() / CLOCKS_PER_SEC << " secs" << endl;
    return 0;
}
