// Cheese-Cracker: cheese-cracker.github.io

void theCode(){
    int n = scan!int;
    auto arr = scanArray!int;
    auto ix = new int[2*n+1];
    ix[] = -1000_000_0;
    for(int i = 0; i < n; ++i){
        ix[arr[i]] = i+1;
    }
    int cnt = 0;
    for(int k = 2; k <= 2*n; ++k){
        for(int i = 1; i * i < k; ++i){
            if(k % i == 0 && ix[k/i] + ix[i] == k){
                ++cnt;
            }
        }
    }
    writeln(cnt);
}

void main(){
    long tests = scan;        // Toggle!
    while(tests--) theCode();
}

/*********  That's All Folks!  *********/
import std.stdio, std.random, std.functional, std.container, std.algorithm;
import std.numeric, std.range, std.typecons, std.string, std.math, std.conv;
string[] tk; T scan(T=long)(){while(!tk.length)tk = readln.split; string a=tk.front; tk.popFront; return a.to!T;}
T[] scanArray(T=long)(){ auto r = readln.split.to!(T[]); return r; }
void show(A...)(A a){ debug{ foreach(t; a){stderr.write(t, "| ");} stderr.writeln; } }
alias ll = long, tup = Tuple!(long, "x",  long, "y");
