#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pll pair<ll, ll>
#define pii pair<int, int>
#define fs first
#define sc second
#define pb push_back
#define int ll
signed main()
{
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int n;
cin >> n;
map<int, int> mpx, mpy;
vector<pii> cord(n);
for (int i = 0; i < n; i++)
{
int x, y;
cin >> x >> y;
cord[i] = {x, y};
mpx[x]++;
mpy[x]++;
}
int ans = 0;
for (auto [x, y] : cord)
{
ans += (mpx[x] - 1) * (mpy[y] - 1);
}
cout << ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |