#include <bits/stdc++.h>
#define endl "\n"
#define ll long long
using namespace std;
void work(){
int n; cin >> n;
vector<int>x(n), y(n);
map<int, int> A, B;
for(int i = 0; i < n ;i++){
cin >> x[i] >> y[i];
A[x[i]]++;
B[y[i]]++;
}
ll ans = 0;
for(int i = 0;i < n ; i++){
ans += 1ll * (A[x[i]] - 1) * (B[y[i]] - 1);
}
cout << ans << endl;
}
int main(){
ios_base::sync_with_stdio(0);cin.tie(0);
int t = 1;// cin >> t;
while(t--) work();
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |