#include <bits/stdc++.h>
#define ll long long
#define ff first
#define ss second
#define pb push_back
#define eb emplace_back
#define inf INT_MAX
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define FAR(i, a, b) for (int i = (a); i >= (b); i--)
#define all(x) x.begin(), x.end()
const int MOD = 1e9 + 7;
using namespace std;
void solve()
{
int n, ans = 0;
cin >> n;
int a[n], b[n];
map<int, int> x, y;
FOR(i, 0, n)
{
cin >> a[i] >> b[i];
x[a[i]]++;
y[b[i]]++;
}
FOR(i, 0, n)
ans += (x[a[i]] - 1) * (y[b[i]] - 1);
cout << ans << endl;
}
int main()
{
int T = 1;
// cin >> T;
while (T--)
{
solve();
}
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |