#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long long int lli;
#define pb push_back
#define mp make_pair
#define va(a) a.begin(), a.end()
#define vd(d) d.begin(), d.end(), greater<ll>()
#define vi vector<int>
#define vll vector<long long>
#define pb push_back
#define pll pair<ll, ll>
#define si set<int>
#define sll set<long long>
#define endl "\n"
#define rep(i, a, b) for (ll i = a; i < b; i++)
#define demonb95                      \
    ios_base::sync_with_stdio(false); \
    cin.tie(NULL);                    \
    cout.tie(NULL)
void solve()
{
    ll n;
    cin >> n;
    vector<pll> v;
    rep(i, 0, n)
    {
        ll x;
        cin >> x;
        v.pb(mp(x, i + 1));
    }
    sort(va(v));
    ll count = 0;
    rep(i, 0, n)
    {
        rep(j, i + 1, n)
        {
            ll a = v[i].first * v[j].first;
            ll b = v[i].second + v[j].second;
            if (a == b)
                count++;

            if (a > 2 * n)
                break;
        }
    }
    cout << count << endl;
}
int main()
{
    demonb95;

    ll t;
    cin >> t;
    while (t--)
    {
        solve();
    }
    return 0;
}