#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

//int xrow[8]={0,  0, -1, 1, -1, 1, -1,  1};
//int xcol[8]={1, -1,  0, 0,  1, 1, -1, -1};

//ll gcd(ll a, ll b){return b ? gcd(b, a % b) : a;}
//ll lcm(ll a, ll b){return a * b / gcd(a, b);}
const int N = 1e5 + 9, M = 1e2 + 9, MOD = 1e9 + 7;
int tc, n, x, y;
ll ans = 0;
pair<int, int> p[N];
int main() {
    //freopen("input.in","r",stdin);   //EOF
    //freopen("output.txt","w",stdout);
    scanf("%d", &tc);
    while(tc--){
        ans = 0;
        scanf("%d", &n);
        x = (n * 2) - 1;
        for(int i = 0; i < n; ++i){
            scanf("%d", &y);
            p[i].first = y;
            p[i].second = i + 1;
        }
        sort(p, p+n);
        for(int i = 0; i < n; ++i){
            y = x / p[i].first;
            for(int j = i + 1; j < n; ++j){
                if(p[j].first > y)
                    break;
                int a = p[i].first * p[j].first;
                if((p[i].second + p[j].second) == a)
                    ++ans;
            }
        }
        printf("%lld\n", ans);
    }
    return 0;
}