#include <bits/stdc++.h>
struct Sum {
  int sum, num = 1;
};
struct Minus {
  int minus, num = 1;
};
int main() {
  int n, countt = 0;
  struct Sum a[200005];
  struct Minus b[200005];
  int x, y;
  scanf("%d", &n);
  scanf("%d%d", &x, &y);
  a[0].sum = x + y;
  b[0].minus = x - y;
  int p = 1, q = 1;
  for (int i = 1; i < n; i++) {
    scanf("%d%d", &x, &y);
    a[p].sum = x + y;
    b[q].minus = x - y;
    int isLeap1 = 0, isLeap2 = 0;
    for (int j = 0; j < p; j++) {
      if (a[p].sum == a[j].sum) {
        a[j].num++;
        isLeap1 = 1;
        break;
      }
    }
    for (int j = 0; j < q; j++) {
      if (b[q].minus == b[j].minus) {
        b[j].num++;
        isLeap2 = 1;
        break;
      }
    }
    if (isLeap1 == 0) {
      p++;
    }
    if (isLeap2 == 0) {
      q++;
    }
  }
  int count = 0;
  for (int i = 0; i < p; i++) {
    count += (a[i].num - 1) * a[i].num / 2;
  }
  for (int i = 0; i < q; i++) {
    count += (b[i].num - 1) * b[i].num / 2;
  }
  printf("%d\n", count);
  return 0;
}
