1int n; cin>>n;
2long val;
3map<int,long> mp3;
4long long res=0;
5while(n--){
6 cin>>val;
7 if(mp3.count(val)) res+=mp3[val];
8 //mp3.count(val) returns 1 if val is present in the map already or
9 //the number of times the key K is present in the map container.
10 if(mp2.count(val)) mp3[val*r]+=mp2[val];
11 mp2[val*r]++;
12}
13cout<<res<<endl;