#include <bits/stdc++.h>
const long long inf = 1000000000000000000;
using namespace std;
bool prime[1000005];
long long gcd(long long a, long long b) {
  if (a < b) gcd(b, a);
  if (b == 0) return a;
  return gcd(b, a % b);
}
long long lcm(long long a, long long b) {
  long long x = (a / gcd(a, b)) * b;
  return x;
}
long long power(long long x, long long n, long long m = inf) {
  if (x == 0) {
    return 0;
  }
  if (n == 0) {
    return 1;
  }
  long long ans;
  if (n % 2 == 0) {
    long long smallAns = power(x, n / 2, m);
    ans = (smallAns * smallAns) % m;
  } else {
    long long smallAns = power(x, n - 1, m);
    ans = x;
    ans = (ans * smallAns) % m;
  }
  return (ans + m) % m;
}
void fillPrime() {
  long long i, j;
  long long n = 1000001;
  for (int i = 0; i < n; i += 1) {
    prime[i] = 1;
  }
  prime[0] = 0;
  prime[1] = 0;
  for (i = 2; i * i <= n; i++) {
    if (prime[i]) {
      for (j = i * i; j <= n; j += i) {
        prime[j] = 0;
      }
    }
  }
}
bool compare(pair<long long, long long> p1, pair<long long, long long> p2) {
  if (p1.second == p2.second) return p1.first < p2.first;
  return p1.second < p2.second;
}
int dx[] = {1, -1, 0, 0};
int dy[] = {0, 0, 1, -1};
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int t = 1;
  while (t--) {
    int n;
    cin >> n;
    pair<long long, long long> arr[n];
    for (int i = 0; i < n; i += 1) {
      cin >> arr[i].first >> arr[i].second;
    }
    sort(arr, arr + n);
    long long ans = 0;
    int j = 0;
    long long count = 1;
    for (int i = 1; i < n; i += 1) {
      if (arr[i].first == arr[j].first)
        count++;
      else {
        if (count == 1) {
          j = i;
          continue;
        } else {
          ans += ((count) * (count - 1)) / 2;
          count = 1;
          j = i;
        }
      }
    }
    ans += ((count) * (count - 1)) / 2;
    count = 1;
    j = 0;
    sort(arr, arr + n, compare);
    for (int i = 1; i < n; i += 1) {
      if (arr[i].second == arr[j].second)
        count++;
      else {
        if (count == 1) {
          j = i;
          continue;
        } else {
          ans += ((count) * (count - 1)) / 2;
          count = 1;
          j = i;
        }
      }
    }
    ans += ((count) * (count - 1)) / 2;
    long long ch = 1;
    j = 0;
    for (int i = 1; i < n; i += 1) {
      if (arr[i].first == arr[j].first && arr[i].second == arr[j].second)
        ch++;
      else {
        if (ch == 1) {
          j = i;
          continue;
        } else {
          ans -= ((ch) * (ch - 1)) / 2;
          ch = 1;
          j = i;
        }
      }
    }
    ans -= ((ch) * (ch - 1)) / 2;
    cout << ans << '\n';
  }
  return 0;
}
