#include <bits/stdc++.h>
using namespace std;
int main(void) {
  ios_base::sync_with_stdio(false);
  int n;
  long long count = 0;
  int fin_c_count = 0, fin_d_count = 0;
  vector<int> a, b, c, d;
  map<int, int> m_1, m_2;
  int value, value_1;
  cin >> n;
  for (int i = 0; i < n; i++) {
    int val, val_1;
    cin >> val >> val_1;
    a.push_back(val);
    b.push_back(val_1);
    value = a[i] + b[i];
    value_1 = a[i] - b[i];
    c.push_back(value);
    d.push_back(value_1);
    m_1[value]++;
    m_2[value_1]++;
  }
  set<int> s_1, s_2;
  for (int i = 0; i < n; i++) {
    s_1.insert(c[i]);
    s_2.insert(d[i]);
  }
  set<int>::iterator is;
  for (is = s_1.begin(); is != s_1.end(); is++) {
    if (m_1[*is] > 1) {
      for (int i = 1; i < m_1[*is]; i++) count += i;
    }
  }
  for (is = s_2.begin(); is != s_2.end(); is++) {
    if (m_2[*is] > 1) {
    }
    for (int i = 1; i < m_2[*is]; i++) count += i;
  }
  cout << count << "\n";
  return 0;
}
