#include <bits/stdc++.h>
using namespace std;
const int maxn = 2005;
int a[maxn], b[maxn];
int c(int n) { return n * (n - 1) / 2; }
int main() {
  memset(a, 0, sizeof(a));
  memset(b, 0, sizeof(b));
  int n;
  scanf("%d", &n);
  int x, y;
  for (int i = 1; i <= n; i++) {
    scanf("%d%d", &x, &y);
    a[x + y]++;
    b[x - y + 1000]++;
  }
  long long ans = 0;
  for (int i = 1; i <= 2000; i++) {
    ans += c(a[i]);
    ans += c(b[i]);
  }
  cout << ans << endl;
}
