#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <set>
#include <map>
using namespace std;
struct star
{
int x, y;
};
int main()
{
map<int, set<int>> rows;
map<int, set<int>> cols;
vector<star> stars;
int t;
cin >> t;
for (int i = 0; i < t; i++)
{
star s;
cin >> s.x >> s.y;
stars.push_back(s);
if (rows.count(s.y) == 0)
{
rows.insert(make_pair(s.y, set<int>()));
}
rows[s.y].insert(s.x);
if (cols.count(s.x) == 0)
{
cols.insert(make_pair(s.x, set<int>()));
}
cols[s.x].insert(s.y);
}
long int ans = 0;
for (star s : stars)
{
set<int>::iterator ix = rows[s.y].find(s.x);
int x = distance(rows[s.y].begin(), ix);
int up = x;
int down = rows[s.y].size() - x - 1;
set<int>::iterator iy = cols[s.x].find(s.y);
int y = distance(cols[s.x].begin(), iy);
int left = y;
int right = cols[s.x].size() - y - 1;
ans += up * right;
ans += left * up;
ans += down * left;
ans += right * down;
}
cout << ans << "\n";
}