Watchmen are in a danger and Doctor Manhattan together with his friend Daniel Dreiberg should warn them as soon as possible. There are n watchmen on a plane, the i-th watchman is located at point (xi, yi).

They need to arrange a plan, but there are some difficulties on their way. As you know, Doctor Manhattan considers the distance between watchmen i and j to be |xi - xj| + |yi - yj|. Daniel, as an ordinary person, calculates the distance using the formula <image>.

The success of the operation relies on the number of pairs (i, j) (1 ≤ i < j ≤ n), such that the distance between watchman i and watchmen j calculated by Doctor Manhattan is equal to the distance between them calculated by Daniel. You were asked to compute the number of such pairs.

Input

The first line of the input contains the single integer n (1 ≤ n ≤ 200 000) — the number of watchmen.

Each of the following n lines contains two integers xi and yi (|xi|, |yi| ≤ 109).

Some positions may coincide.

Output

Print the number of pairs of watchmen such that the distance between them calculated by Doctor Manhattan is equal to the distance calculated by Daniel.

Examples

Input

3
1 1
7 5
1 5


Output

2


Input

6
0 0
0 1
0 2
-1 1
0 1
1 1


Output

11

Note

In the first sample, the distance between watchman 1 and watchman 2 is equal to |1 - 7| + |1 - 5| = 10 for Doctor Manhattan and <image> for Daniel. For pairs (1, 1), (1, 5) and (7, 5), (1, 5) Doctor Manhattan and Daniel will calculate the same distances.
#include <bits/stdc++.h>
using namespace std;
const int inf = 2147483647;
const long long linf = 9223372036854775807;
const double Pi = 3.141592653589793;
const int mod = 1000000007;
bool potok = false;
char input;
bool negative;
bool scan(int &x) {
  if (potok) return 0;
  input = getchar();
  negative = 0;
  if (input == EOF) {
    potok = 1;
    return 0;
  }
  while (input == ' ' || input == 10 || input == 11 || input == 14) {
    input = getchar();
  }
  if (input == EOF) {
    potok = 1;
    return 0;
  }
  if (input < '0' && input > '9' && input != '-') return 0;
  if (input == '-') {
    negative = 1;
    input = getchar();
    if (input == EOF) {
      potok = 1;
      return 0;
    }
  }
  if (input < '0' || input > '9') return 0;
  x = 0;
  while (input >= '0' && input <= '9') {
    x = x * 10 + (input - '0');
    input = getchar();
  }
  if (input == EOF) potok = 1;
  x *= (negative ? -1 : 1);
  return 1;
}
bool scan(long long &x) {
  if (potok) return 0;
  input = getchar();
  negative = 0;
  if (input == EOF) {
    potok = 1;
    return 0;
  }
  while (input == ' ' || input == 10 || input == 11 || input == 14) {
    input = getchar();
  }
  if (input == EOF) {
    potok = 1;
    return 0;
  }
  if (input < '0' && input > '9' && input != '-') return 0;
  if (input == '-') {
    negative = 1;
    input = getchar();
    if (input == EOF) {
      potok = 1;
      return 0;
    }
  }
  if (input < '0' || input > '9') return 0;
  x = 0;
  while (input >= '0' && input <= '9') {
    x = x * 10 + (input - '0');
    input = getchar();
  }
  if (input == EOF) potok = 1;
  x *= (negative ? -1 : 1);
  return 1;
}
bool scan(unsigned long long &x) {
  if (potok) return 0;
  input = getchar();
  negative = 0;
  if (input == EOF) {
    potok = 1;
    return 0;
  }
  while (input == ' ' || input == 10 || input == 11 || input == 14) {
    input = getchar();
  }
  if (input == EOF) {
    potok = 1;
    return 0;
  }
  if (input < '0' && input > '9' && input != '-') return 0;
  if (input == '-') {
    negative = 1;
    input = getchar();
    if (input == EOF) {
      potok = 1;
      return 0;
    }
  }
  if (input < '0' || input > '9') return 0;
  x = 0;
  while (input >= '0' && input <= '9') {
    x = x * 10 + (input - '0');
    input = getchar();
  }
  if (input == EOF) potok = 1;
  x *= (negative ? -1 : 1);
  return 1;
}
bool scan(unsigned &x) {
  if (potok) return 0;
  input = getchar();
  negative = 0;
  if (input == EOF) {
    potok = 1;
    return 0;
  }
  while (input == ' ' || input == 10 || input == 11 || input == 14) {
    input = getchar();
  }
  if (input == EOF) {
    potok = 1;
    return 0;
  }
  if (input < '0' && input > '9' && input != '-') return 0;
  if (input == '-') {
    negative = 1;
    input = getchar();
    if (input == EOF) {
      potok = 1;
      return 0;
    }
  }
  if (input < '0' || input > '9') return 0;
  x = 0;
  while (input >= '0' && input <= '9') {
    x = x * 10 + (input - '0');
    input = getchar();
  }
  if (input == EOF) potok = 1;
  x *= (negative ? -1 : 1);
  return 1;
}
bool scan(char &s) {
  if (potok) return 0;
  input = getchar();
  if (input == EOF) {
    potok = 1;
    return 0;
  }
  while (input == ' ' || input == 10 || input == 11 || input == 14) {
    input = getchar();
  }
  if (input == EOF) {
    potok = 1;
    return 0;
  }
  s = input;
  return 1;
}
bool scan(char s[]) {
  if (potok) return 0;
  input = getchar();
  if (input == EOF) {
    potok = 1;
    return 0;
  }
  while (input == ' ' || input == 10 || input == 11 || input == 14) {
    input = getchar();
  }
  if (input == EOF) {
    potok = 1;
    return 0;
  }
  char *t = s;
  while (input != ' ' && input != 10 && input != 11 && input != 14 &&
         input != EOF) {
    *t = input;
    t++;
    input = getchar();
  }
  return 1;
}
bool scan(double &x) {
  if (potok) return 0;
  input = getchar();
  negative = 0;
  if (input == EOF) {
    potok = 1;
    return 0;
  }
  while (input == ' ' || input == 10 || input == 11 || input == 14) {
    input = getchar();
  }
  if (input == EOF) {
    potok = 1;
    return 0;
  }
  if (input < '0' && input > '9' && input != '-') return 0;
  if (input == '-') {
    negative = 1;
    input = getchar();
    if (input == EOF) {
      potok = 1;
      return 0;
    }
  }
  if (input < '0' || input > '9') return 0;
  x = 0.0;
  register bool f = 0;
  register int h = 10;
  while ((input >= '0' && input <= '9') || (input == '.' && !f)) {
    if (input == '.') {
      f = 1;
      input = getchar();
      if (input == EOF) {
        potok = 1;
        return 0;
      }
    }
    if (f) {
      x += double(input - '0') / h;
      h *= 10;
    } else
      x = x * 10 + (input - '0');
    input = getchar();
  }
  x *= (negative ? -1 : 1);
  return 1;
}
template <typename X>
void getarr(X *a, int n) {
  for (int i = 0; i < n; i++) scan(a[i]);
}
void getarr(string *a, int n) {
  for (int i = 0; i < n; i++) cin >> a[i];
}
template <typename X>
void putarr(X *a, int n, char ch = ' ') {
  for (int i = 0; i < n; i++) cout << a[i] << ch;
}
inline bool XOR(bool p, bool q) { return ((p || q) && !(p && q)); }
template <typename X>
inline X abs(X a) {
  return a < 0 ? -1 * a : a;
}
template <typename T>
inline auto sqr(T a) -> decltype(a * a) {
  return a * a;
}
template <typename T>
inline auto cub(T a) -> decltype(a * a * a) {
  return a * a * a;
}
inline void swap(int &a, int &b) {
  a ^= b;
  b ^= a;
  a ^= b;
}
inline void swap(unsigned &a, unsigned &b) {
  a ^= b;
  b ^= a;
  a ^= b;
}
inline void swap(long long &a, long long &b) {
  a ^= b;
  b ^= a;
  a ^= b;
}
inline void swap(unsigned long long &a, unsigned long long &b) {
  a ^= b;
  b ^= a;
  a ^= b;
}
template <typename T>
T lcm(T a, T b) {
  return a / gcd(a, b) * b;
}
template <typename X>
int binf(X *a, int l, int r, X p) {
  while (l < r) {
    int m = (l + r) >> 1;
    if (p > a[m])
      l = m + 1;
    else
      r = m;
  }
  if (a[l] == p)
    return l;
  else
    return -1;
}
template <typename X>
X gcd(X a, X b) {
  while (b) {
    a %= b;
    swap(a, b);
  }
  return a;
}
template <typename X>
X gcd(X a, X b, X &x, X &y) {
  if (a == 0) {
    x = 0;
    y = 1;
    return b;
  }
  X x1, y1;
  X d = gcd(b % a, a, x1, y1);
  x = y1 - (b / a) * x1;
  y = x1;
  return d;
}
template <typename X>
X binpow(X a, int n, int m = 0) {
  X res = 1;
  if (m) res %= m;
  while (n) {
    if (n & 1) {
      res *= a;
      if (m) res %= m;
    }
    a *= a;
    if (m) a %= m;
    n >>= 1;
  }
  return res;
}
pair<int, int> a[200000];
inline bool cmp(pair<int, int> x, pair<int, int> y) {
  if (x.second == y.second) return x.first < y.first;
  return x.second < y.second;
}
int main() {
  ios::sync_with_stdio(0);
  int n;
  scan(n);
  for (int i = 0; i < n; i++) {
    int x, y;
    scan(x);
    scan(y);
    a[i] = make_pair(x, y);
  }
  sort(a, a + n);
  long long s = 0;
  for (int i = 0; i < n; i++) {
    long long p = 1;
    while (i < n - 1 && a[i].first == a[i + 1].first) {
      p++;
      i++;
    }
    s += p * (p - 1) / 2;
  }
  sort(a, a + n, cmp);
  for (int i = 0; i < n; i++) {
    long long p = 1;
    while (i < n - 1 && a[i].second == a[i + 1].second) {
      p++;
      i++;
    }
    s += p * (p - 1) / 2;
  }
  for (int i = 0; i < n; i++) {
    long long p = 1;
    while (i < n - 1 && a[i].second == a[i + 1].second &&
           a[i].first == a[i + 1].first) {
      p++;
      i++;
    }
    s -= p * (p - 1) / 2;
  }
  cout << s;
  return 0;
}
