In this HackerEarth The Electric Type problem solution Everyone knows that some special Pikachus hate evolving into Raichus. (The legend says because Raichu is ugly, and Pikachu looks good!)

The question is how do we find these special Pikachus who hate evolution? The crazy Poke'mon trainer Ash Catch'Em has derived a random algorithm, which is completely wrong, but since he's your friend, you've to humor him and his crazy algorithms.

He thinks if you are given N Pikachus in an array, A1,A2 ... AN, where each Pikachu is denoted by an integer. The total number of unique pairs (Ai,Aj) where i < j is the number of Pikachus who hate evolution.

## HackerEarth The Electric Type problem solution.

```#include <iostream>
#include <sstream>
#include <fstream>
#include <string>
#include <iomanip>
#include <vector>
#include <deque>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <utility>
#include <bitset>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cstdio>
using namespace std;

#define rep(i,n) for(int i=0;i<n;i++)
#define ll  long long int
#define pi pair<ll,ll>
#define pii pair<ll,pi>
#define f first
#define mp make_pair
#define mod 1000000007
#define s second
#define pb push_back
int A[200011];
int main(){

freopen("in01.txt","r",stdin);
freopen("out01.txt","w",stdout);

int N;
cin >> N;
map<int,int>M;
set<int>s;

rep(i,N){
cin >> A[i];
M[A[i]] = i;
s.insert(A[i]);
}

set<int>consider;
for(map<int,int>::iterator it = M.begin();it!=M.end();it++){
consider.insert((*it).s);
}
ll ans = 0;
rep(i,N){
if(consider.count(i)){
ans += s.size();
}
s.insert(A[i]);
}
cout<<ans;

}```