#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mod = 1e9 + 7;
#pragma GCC optimize("Ofast")
#define vi vector<int>
#define vll vector<ll>
#define pii pair<int, int>
#define mp make_pair
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define fi first
#define sc second
#define endl '\n'
#define gl ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
int main()
{
gl
int n;
cin >> n;
map<int, ll> x, y;
vi a(n, 0), b(n, 0);
for(int i = 0; i < n; i++){
cin >> a[i] >> b[i];
x[a[i]]++;
y[b[i]]++;
}
ll ans = 0;
for(int i = 0; i < n; i++){
ans += (x[a[i]] - 1) * (y[b[i]] - 1);
}
cout << ans << endl;
}