#include <bits/stdc++.h>
int sum[2009], minus[2009];
int n;
int comb2(int k) { return (k * (k - 1)) / 2; }
int main() {
  memset(&sum, 0, sizeof sum);
  memset(&minus, 0, sizeof minus);
  int x, y;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%d %d", &x, &y);
    sum[x + y]++;
    minus[x - y + 1000]++;
  }
  int ans = 0;
  for (int i = 0; i < 2009; i++) {
    ans += comb2(sum[i]);
    ans += comb2(minus[i]);
  }
  printf("%d\n", ans);
  return 0;
}
