#include <bits/stdc++.h>
#define int long long
using namespace std;
signed main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int n;
cin >> n;
vector<int> x(n + 1);
vector<int> y(n + 1);
for(int i = 1; i <= n; i++) {
cin >> x[i] >> y[i];
}
map<int,int> cntx;
map<int,int> cnty;
for(int i = 1; i <= n; i++) {
cntx[x[i]] += 1;
cnty[y[i]] += 1;
}
int ans = 0;
for(int i = 1; i <= n; i++) {
ans += (cntx[x[i]] - 1) * (cnty[y[i]] - 1);
}
cout << ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |