#include<iostream>
#include<unordered_set>
#include<set>
#include<list>
#include<map>
#include<stack>
#include<string>
#include<iterator>
#include<math.h>
#include<limits.h>
#include<vector>
#include<algorithm>
#include<cstring>
using namespace std;
#define fast ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr)
#define ll long long
#define ull unsigned long long
#define pb push_back
#define MOD 1000000007
#define MAX 1000001


int main(){
	fast;
	ll t, n, ai;
	cin>>t;
	while(t--){
		cin>>n;
		vector< pair<int, int> > nums;
		for(int i = 0;i<n;i++){
			cin>>ai;
			nums.pb(make_pair(ai,i));
		}
		sort(nums.begin(), nums.end());
		// for(ll i = 0;i<n;i++){
		// 	cout<<nums[i].first<<' '<<nums[i].second<<'\n';
		// }
		ll count = 0;
		for(int i = 0;i<n;i++){
			for(int j=i+1;j<n;j++){
				ll v = (ll)nums[i].first*(ll)nums[j].first;
				ll ind = nums[i].second + nums[j].second;
				if(v==(ind+2))
					count++;
				if(v >= 2*n)
					break;
			}
		}
		cout<<count<<'\n';
	}
	return 0;
}