1map_name.count(key k)
2/*
3 Parameters: k which specifies the key to be searched in the map container.
4 Return Value: returns the number of times the key K is present in the map container.
5 "RETURNS 0"- if the key is not present in the map container.
6*/
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;