//=======================================================================================================================================================================================================================================================================================================================
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define fi first
#define se second
#define pii pair<int,int>
int main() {
ios_base::sync_with_stdio(false);cin.tie(nullptr);
int n; cin >> n;
int x[n], y[n];
map<int,int> X,Y;
for(int i=0;i<n;i++){
cin >> x[i] >> y [i];
X[x[i]]++; Y[y[i]]++;
}
ll ans=0;
for(int i=0;i<n;i++){
ans+= (X[x[i]]-1) * (Y[y[i]]-1);
}
cout << ans << endl;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |