#include<bits/stdc++.h>
using namespace std;
#define int long long
// JANGAN LUPA CEK PERLU LL NGGAK
#define pb push_back
#define miku ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define pii pair<int,int>
signed main(){
miku
int n;cin>>n;
map<pii,int>xy;
map<int,int>x,y;
for(int i=1;i<=n;i++){
int a,b;cin>>a>>b;
x[a]++;
y[b]++;
xy[{a,b}]++;
}
int ans=0;
for(auto [pxy,val]:xy){
auto [px,py]=pxy;
int xx=x[px]-val;
int yy=y[py]-val;
int res=xx*yy*val;
ans+=res;
}
cout<<ans;
}
// very mathy
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |