#include <bits/stdc++.h>
using namespace std;
const int MAX = 2005;
int cnt[MAX][2];
int main() {
  int n;
  scanf("%d", &n);
  memset(cnt, 0, sizeof(cnt));
  for (int i = 0; i < n; ++i) {
    int x, y;
    scanf("%d%d", &x, &y);
    cnt[y - x + 1000][0]++;
    cnt[x + y][1]++;
  }
  int ans = 0;
  for (int i = 0; i < MAX; ++i) {
    if (cnt[i][0] >= 2) ans += cnt[i][0] * (cnt[i][0] - 1) / 2;
    if (cnt[i][1] >= 2) ans += cnt[i][1] * (cnt[i][1] - 1) / 2;
  }
  printf("%d\n", ans);
  return 0;
}
