#include <bits/stdc++.h>
using namespace std;
int xSubY[2005];
int xAddY[2005];
long long c[1005][1005];
void init() {
  c[0][0] = 1;
  for (int i = 1; i <= 1000; i++) {
    c[i][0] = 1;
    c[i][i] = 1;
    for (int j = 1; j < i; j++) c[i][j] = (c[i - 1][j - 1] + c[i - 1][j]);
  }
}
int main() {
  init();
  int n;
  int x, y;
  scanf("%d", &n);
  for (int i = 0; i < n; ++i) {
    scanf("%d%d", &x, &y);
    xSubY[x - y + 1000]++;
    xAddY[x + y]++;
  }
  long long ans = 0;
  for (int i = 0; i <= 2000; ++i) {
    ans += c[xSubY[i]][2];
    ans += c[xAddY[i]][2];
  }
  cout << ans;
  return 0;
}
