#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:102400000,102400000")
using namespace std;
const long long MOD = 1e9 + 7;
int t1 = 0, t2 = 0, n;
long long ans = 0;
int a[2005], b[2005];
int main() {
  scanf("%d", &n);
  int x, y;
  for (int i = 1; i <= n; i++) {
    scanf("%d%d", &x, &y);
    a[x - y + 1000]++;
    b[y + x]++;
  }
  for (int i = 1; i < 2005; i++) {
    if (a[i] >= 2) {
      ans += (long long)(a[i] - 1) * (a[i]) / 2;
    }
    if (b[i] >= 2) ans += (long long)(b[i] - 1) * b[i] / 2;
  }
  cout << ans << endl;
}
