#include <bits/stdc++.h>
using namespace std;
long long Set(long long N, long long pos) { return N = N | (1LL << pos); }
long long reset(long long N, long long pos) { return N = N & ~(1LL << pos); }
bool check(long long N, long long pos) { return (bool)(N & (1LL << pos)); }
long long dx[] = {1, 0, -1, 0};
long long dy[] = {0, 1, 0, -1};
map<long long, long long> mp;
signed main() {
  long long t = 1, cs = 1;
  while (t--) {
    long long n;
    cin >> n;
    while (n--) {
      long long a, b;
      cin >> a >> b;
      mp[a + b]++;
      mp[5000 + a - b]++;
    }
    long long ans = 0;
    for (auto it = mp.begin(); it != mp.end(); it++) {
      long long x = it->second;
      x *= (x - 1);
      x /= 2;
      ans += x;
    }
    cout << ans << '\n';
  }
}
