#include <bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define ld long double
#define inarray(a, n) for(int i = 0; i < n; i++) cin>>a[i];
#define inparray(a, n) for(int i = 0; i < n; i++) {ll x, y; cin>>x>>y; a[i]={x,y};}
#define all(a) a.begin(), a.end()
#define sayyes cout<<"YES\n";
#define sayno cout<<"NO\n";
#define sigma(n) ((n*(n+1))/2)
#define yesno(b) if(b) cout<<"YES\n"; else cout<<"NO\n";
#define int long long
#define M 1000000007LL
using namespace std;

template <typename T> using minheap = priority_queue<T, vector<T>, greater<T>>;

class myComparator
{
public:
    int operator() (const pair<ll, ll>& p1, const pair<ll, ll>& p2)
    {
        return p1.first < p2.first || p1.first == p2.first && p1.second < p2.second;
    }
}cmp;

ll hcf(ll a, ll b) 
{ 
    if (a == 0) 
        return b; 
    return hcf(b % a, a); 
}

struct frac {
    ll n, d;

    frac operator + (const frac& rhs) {
        frac t = {n*rhs.d + rhs.n*d, d*rhs.d};
        ll h = hcf(t.n, t.d);
        t.n /= h;
        t.d /= h;
        return t;
    }
    frac operator - (const frac& rhs) {
        frac t = {n*rhs.d - rhs.n*d, d*rhs.d};
        ll h = hcf(t.n, t.d);
        t.n /= h;
        t.d /= h;
        return t;
    }
    frac operator * (const frac& rhs) {
        frac t = {n*rhs.n, d*rhs.d};
        ll h = hcf(t.n, t.d);
        t.n /= h;
        t.d /= h;
        return t;
    }
    frac operator * (const int& rhs) {
        frac t = {rhs * n, d};
        ll h = hcf(t.n, t.d);
        t.n /= h;
        t.d /= h;
        return t;
    }
    frac inv() {
        return {d, n};
    }
};

void swp(ll &a, ll &b) {
    ll t = a;
    a = b;
    b = t;
}

ll fastexp(ll a, ll b)
{
    ll ans = 1;
    while(b)
    {
        if(b&1)
        {
            ans *= a;
        }
        b >>= 1;
        a = a*a;
    }
    return ans;
}

ll fastexpmodm(ll a, ll b, ll m)
{
    ll ans = 1;
    a%=m;
    if(a == 0) return 0;
    while(b)
    {
        if(b&1)
        {
            ans = (ans*a)%m;
        }
        b >>= 1;
        a = (a*a)%m;
    }
    return ans;
}

frac fastexp(frac a, ll b) {
    frac ans = {1, 1};
    while(b) {
        if(b&1) {
            ans = ans * a;
        }
        b >>= 1;
        a = a*a;
    }
    return ans;
}

ll modPow(ll  a, ll x, ll p) {
    //calculates a^x mod p in logarithmic time.
    ll res = 1;
    while(x > 0) {
        if( x % 2 != 0) {
            res = (res * a) % p;
        }
        a = (a * a) % p;
        x /= 2;
    }
    return res;
}
ll modInverse(ll a, ll p) {
    //calculates the modular multiplicative of a mod m.
    //(assuming p is prime).
    return modPow(a, p-2, p);
}

ll moddiv(ll a, ll b, ll m)
{
    a = a % m;
    ll inv = modInverse(b, m);
    if (inv == -1)
        return 0;
    else
    return(inv * a) % m;
}

struct edge {
    ll t, l, a;
};

signed main()
{
    // ifstream cin("mainin.txt");
    // ofstream cout("mainout.txt");
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);  

    int t;
    cin>>t;
    while(t--) {
        ll n;
        cin>>n;
        unordered_map<ll, ll> m;
        vector<ll> a(n);
        for(int i = 0; i < n; i++) {
            cin>>a[i];
            m[a[i]] = i+1;
        }
        ll ans = 0;
        for(int i = 0; i < n; i++) {
            for(int j = 1; ; j++) {
                ll x = a[i]*j-i-1;
                if(m.find(j) != m.end() && m[j] == a[i]*j - i - 1 && m[j] > i+1) ans++;
                if(a[i]*j-i-1 > n) break;
            }
        }
        
        cout<<ans<<'\n';
    }
    return 0;
}
/*
7 8 -- 0
6 6 -- 1
5 4 -- 2
4 2 -- 3

*/