#include <bits/stdc++.h>
using namespace std;
inline string trail_zero(string &str) {
  int second;
  string ret = "";
  for (int i = 0; i < str.size(); i++) {
    if (str[i] != '0') {
      second = i;
      break;
    }
  }
  for (int i = second; i < str.size(); i++) {
    ret += str[i];
  }
  return ret;
}
inline long long int power(long long int x, long long int y) {
  long long int res = 1;
  for (long long int i = 1; i <= y; i++) {
    res *= x;
  }
  return res;
}
inline int string_int(string &str) {
  int len = str.length();
  int num = 0;
  for (int i = len - 1, j = 0; i >= 0; i--, j++) {
    num += (str[i] - '0') * power(10, j);
  }
  return num;
}
inline int nCr(int n, int r) {
  if (r == 1)
    return n;
  else if (n == r)
    return 1;
  else
    return (nCr(n - 1, r) + nCr(n - 1, r - 1));
}
inline bool prime_check(int n) {
  if (n < 2) return false;
  for (int i = 2; i * i <= n; i++) {
    if (n % i == 0) return false;
  }
  return true;
}
inline bool leap_year(int year) {
  if (year % 4 == 0 || (year % 4 == 0 && year % 1000 != 0))
    return true;
  else
    return false;
}
const double eps = 1e-9;
const int SIZE = 20000005;
const int Size = 100005;
const int MOD = 1000000007;
const double PI = 2 * acos(0.0);
const long long INF = 9876543210987654;
long long int n, ara[SIZE];
map<long long int, long long int> m1, m2;
long long int x, y, sum = 0;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> x >> y;
    sum += m1[x + y]++;
    sum += m2[x - y]++;
  }
  cout << sum << '\n';
  return 0;
}
