#include <algorithm>
#include <functional>
#include <iostream>
#include <list>
#include <map>
using namespace std;
signed main () {
ios::sync_with_stdio (false);
cin.tie (0);
cout.tie (0);
int N = 0;
cin >> N;
vector <pair <int, int> > v (N + 1);
for (int i = 1; i <= N; i++)
cin >> v[i].first >> v[i].second;
map <int, int> byY;
map <int, int> byX;
for (int i = 1; i <= N; i++) {
byY[v[i].first]++;
byX[v[i].second]++;
}
long long ans = 0;
for (int i = 1; i <= N; i++)
ans += 1ll * (byY[v[i].first] - 1) * (byX[v[i].second] - 1);
cout << ans << '\n';
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |