#include <bits/stdc++.h>
using namespace std;
long long x, y;
const double PI = 3.14159265359;
bool compare(const pair<long long, long long> &a,
             const pair<long long, long long> &b) {
  long long x1, y1, x2, y2;
  x1 = a.first;
  x2 = b.first;
  y1 = a.second;
  y2 = b.second;
  return ((x1 - x) * (x1 - x) + (y1 - y) * (y1 - y) <
          (x2 - x) * (x2 - x) + (y2 - y) * (y2 - y));
}
long long greatestCommonDivisor(long long m, long long n) {
  int r;
  if ((m == 0) || (n == 0))
    return 0;
  else if ((m < 0) || (n < 0))
    return -1;
  do {
    r = m % n;
    if (r == 0) break;
    m = n;
    n = r;
  } while (true);
  return n;
}
long long value(long long n, long long a, long long b, long long c) {
  if (n < a && n < b)
    return 0;
  else
    return max(value(n - a, a, b, c) + 1, value(n - b + c, a, b, c) + 1);
}
long long fib(long long n) {
  cout << n << " ";
  if (n == 0) return 0;
  if (n == 2 || n == 1) return 1;
  if (n % 2 == 0)
    return fib(n / 2) * fib(n / 2) + fib(n / 2 - 1) * fib(n / 2 - 1);
  else
    return fib((n - 1) / 2) * fib((n - 1) / 2 + 1) +
           fib((n - 1) / 2 - 1) * fib((n - 1) / 2);
}
long long a[30002], b[30002] = {0}, total = 0, co = 1;
int root(long long i) {
  while (a[i] != i) i = a[i];
  return i;
}
void un(long long b, long long c) { a[root(b)] = a[root(c)]; }
long long kruskal(pair<long long, pair<long long, long long> > p[],
                  long long n) {
  long long i, j, va, vb;
  for (i = 0; i < n; i++) {
    va = p[i].second.first;
    vb = p[i].second.second;
    if (root(va) != root(vb)) {
      total += p[i].first;
      un(va, vb);
    }
  }
  return total;
}
long long tree[10000] = {0};
long long dp[10][10][3];
long long time(long long n, long long m, long long c, long long t) {
  if (n <= 0 || m <= 0)
    return t;
  else if (dp[n][m][c] != -1)
    return dp[n][m][c];
  else if (c == 1)
    dp[n][m][c] =
        max(time(n - 5, m - 10, 2, t + 1), time(n - 20, m + 5, 3, t + 1));
  else if (c == 2)
    dp[n][m][c] =
        max(time(n + 3, m + 2, 1, t + 1), time(n - 20, m + 5, 3, t + 1));
  else if (c == 3)
    dp[n][m][c] =
        max(time(n - 5, m - 10, 2, t + 1), time(n + 3, m + 2, 1, t + 1));
  return dp[n][m][c];
}
bool cmp(long long a, long long b) { return a > b; }
int main() {
  long long d, i = 1, n, m, j = 0, dist = 0, co = 0, t;
  vector<pair<long long, long long> > a;
  map<pair<long long, long long>, long long> ma;
  map<long long, long long> f, s;
  long long b, c;
  cin >> n;
  long long ans = 0, rem = 99999;
  for (i = 0; i < n; i++) {
    cin >> b >> c;
    a.push_back(make_pair(b, c));
    ans += f[a[i].first] + s[a[i].second] - ma[a[i]];
    f[b]++;
    s[c]++;
    ma[make_pair(b, c)]++;
  }
  cout << ans;
  return 0;
}
