#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define ld long double
#define pi (3.141592653589)
#define pb push_back
#define mp make_pair
#define INF 9223372036854775807
#define MOD 1000000007
#define vll vector<ll>
#define vpll vector<pair<ll,ll> >
#define pll pair<ll , ll>
#define ff first
#define ss second
#define mMul(a , b , m) (a * b) % m
#define mSub(a , b , m) (a - b + m) % m
#define mAdd(a , b , m) (a + b) % m
#define all(a) a.begin() , a.end()
ll gcd(ll a , ll b){if((a == 0) || (b == 0)) return a + b; return gcd(min(a , b) , max(a , b) % min(a , b));}

void solve(){
    ll n;
    cin >> n;
    vll a(n);
    ll j;
    for(j = 0; j < n; j++){
        cin >> a[j];
    }
    set<ll> pos[2 * n + 1];
    for(j = 0; j < n; j++){
        pos[a[j]].insert(j + 1);
    }
    ll cnt = 0;
    for(j = 0; j < n - 1; j++){
        ll val = a[j];
        ll mn = (j + 2 + j + 1 + val - 1) / val;
        ll mx = (n + j + 1 + val - 1) / val;
        ll k;
        for(k = mn; k <= mx; k++){
            ll pro = k * val;
            ll req = pro - (j + 1);
            auto it = pos[k].find(req);
            if(it != pos[k].end()) cnt++;
        }
    }
    cout << cnt << "\n";
}

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