#include <bits/stdc++.h>
using namespace std;
int arr[200000][2], temp[200000][2];
void merge(int startIndex, int lastIndex, int pos) {
  int apos = (pos == 0 ? 1 : 0);
  int mid = (startIndex + lastIndex) / 2, i, j, k;
  for (k = 0, i = startIndex, j = mid + 1; i <= mid && j <= lastIndex;) {
    if (arr[i][pos] <= arr[j][pos]) {
      temp[k][apos] = arr[i][apos];
      temp[k++][pos] = arr[i++][pos];
    } else {
      temp[k][apos] = arr[j][apos];
      temp[k++][pos] = arr[j++][pos];
    }
  }
  while (i <= mid) {
    temp[k][apos] = arr[i][apos];
    temp[k++][pos] = arr[i++][pos];
  }
  while (j <= lastIndex) {
    temp[k][apos] = arr[j][apos];
    temp[k++][pos] = arr[j++][pos];
  }
  for (i = startIndex, j = 0; j < k; ++i, ++j) {
    arr[i][apos] = temp[j][apos];
    arr[i][pos] = temp[j][pos];
  }
}
void mergeSort(int startIndex, int lastIndex, int pos) {
  if (startIndex == lastIndex)
    return;
  else {
    int mid = (startIndex + lastIndex) / 2;
    mergeSort(startIndex, mid, pos);
    mergeSort(mid + 1, lastIndex, pos);
    merge(startIndex, lastIndex, pos);
  }
}
int main() {
  int N, i, j, num;
  long long ans = 0, minus;
  scanf("%d", &N);
  for (i = 0; i < N; ++i) {
    scanf("%d%d", &arr[i][0], &arr[i][1]);
  }
  mergeSort(0, N - 1, 0);
  for (i = 0; i < N; i = j) {
    for (j = i + 1; j < N && arr[j][0] == arr[i][0]; ++j)
      ;
    if (j - i > 1) {
      ans += ((j - i) * 1ll * (j - i - 1)) / 2;
    }
  }
  mergeSort(0, N - 1, 1);
  for (i = 0; i < N; i = j) {
    for (j = i + 1; j < N && arr[j][1] == arr[i][1]; ++j)
      ;
    if (j - i > 1) {
      mergeSort(i, j - 1, 0);
    }
  }
  for (i = 0; i < N; i = j) {
    num = 1;
    minus = 0;
    for (j = i + 1; j < N && arr[j][1] == arr[i][1]; ++j) {
      if (arr[j][0] == arr[j - 1][0]) {
        ++num;
      } else {
        if (num > 1) {
          minus -= (num * 1ll * (num - 1)) / 2;
          num = 1;
        }
      }
    }
    if (num > 1) {
      minus -= (num * 1ll * (num - 1)) / 2;
    }
    if (j - i > 1) {
      ans += ((j - i) * 1ll * (j - i - 1)) / 2;
      ans += minus;
    }
  }
  printf("%I64d", ans);
  return 0;
}
