#include <bits/stdc++.h>
using namespace std;
pair<int, int> pt[5000];
vector<vector<pair<int, int> > > sor;
int main() {
int n;
long long ans = 0;
scanf("%d", &n);
for (int i = 0;i < n;++i)
scanf("%d %d", &pt[i].first, &pt[i].second);
sort(pt, pt + n);
for (int i = 0;i < n;++i) {
if (i == 0 || pt[i].first != pt[i - 1].first)
sor.push_back({ pt[i] });
else
sor.back().push_back(pt[i]);
}
for (int i = 0;i < sor.size();++i)
for (int j = i + 1;j < sor.size();++j) {
int cnt = 0;
for (int k = 0, l = 0;k < sor[i].size() && l < sor[j].size();) {
if (sor[i][k].second == sor[j][l].second) {
cnt++;
if (k + 1 >= sor[i].size() && l + 1 >= sor[j].size())
break;
else if (l + 1 >= sor[j].size())
k++;
else if (k + 1 >= sor[i].size())
l++;
else
k++;
}
else {
if (k + 1 >= sor[i].size() && l + 1 >= sor[j].size())
break;
else if (l + 1 >= sor[j].size())
k++;
else if (k + 1 >= sor[i].size())
l++;
else if (sor[i][k].second < sor[j][l].second)
k++;
else
l++;
}
}
ans += cnt * (cnt - 1) / 2;
}
printf("%lld", ans);
return 0;
}