//int max = 2 147 483 647 (2^31-1)
//ll max = 9 223 372 036 854 775 807 (2^63-1)
#include <bits/stdc++.h>
using namespace std;
#define forn(i, n) for(int i=0; i<n; i++)
#define mp make_pair
#define pb push_back
#define f first
#define s second
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int,int> pi;

//Fast input and output
void fast_io(){
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(NULL);}

//Printing pairs and vectors
template<typename A, typename B> ostream& operator<<(ostream &cout, pair<A, B> const &p) { return cout << "(" << p.f << ", " << p.s << ")"; }
template<typename A> ostream& operator<<(ostream &cout, vector<A> const &v) {
cout << "["; for(int i = 0; i < v.size(); i++) {if (i) cout << ", "; cout << v[i];} return cout << "]";}

int main(){
  int n;
  cin >> n;
  vector<pi>a(n);
  forn(i,n){
    int x,y;
    cin >> x >> y;
    a[i]=mp(x,y);
  }
  int ans=0;
  forn(i,n){
    for(int j=i+1;j<n;j++){
      if(i==j){
        continue;
      }
      pi p=a[i],q=a[j];
      if(p.f>q.f){
        swap(p,q);
      }
      int k = q.f-p.f;
      if(q.s<=p.s+k and q.s>=p.s-k){
        ans++;
      }
    }
  }
  cout << ans;
}

/* Clearink */

#include <cstdio>
#include <cstdlib>
#include <assert.h>

const int MAXN = 200;
int n, match[MAXN + 5];
bool f[MAXN + 5], vis[MAXN + 5];

inline bool check ( const int l, const int r ) {
	int stp = r - l + 1 >> 1; // i -> i + stp.
	for ( int i = l, j; ( j = i + stp ) <= r; ++ i ) {
		bool acci = 1 <= match[i] && match[i] <= n << 1;
		bool accj = 1 <= match[j] && match[j] <= n << 1;
		if ( match[i] == -1 || ( acci  && match[i] ^ j )
		|| match[j] == ( n << 1 | 1 ) || ( accj && match[j] ^ i )
		|| ( !acci && !accj && match[i] && match[j] ) ) {
			return false;
		}
	}
	return true;
}

int main () {
	scanf ( "%d", &n );
	for ( int i = 1, a, b; i <= n; ++ i ) {
		scanf ( "%d %d", &a, &b );
		if ( ~a && ~b && a >= b ) return puts ( "No" ), 0;
		if ( ~a && ~b ) match[a] = b, match[b] = a;
		else if ( ~a ) match[a] = n << 1 | 1;
		else if ( ~b ) match[b] = -1;
		if ( ~a ) {
			if ( vis[a] ) return puts ( "No" ), 0;
			vis[a] = true;
		}
		if ( ~b ) {
			if ( vis[b] ) return puts ( "No" ), 0;
			vis[b] = true;
		}
	}
	f[0] = true;
	for ( int i = 2; i <= n << 1; i += 2 ) {
		for ( int j = 0; j < i && !f[i]; j += 2 ) {
			f[i] = f[j] && check ( j + 1, i );
		}
	}
	puts ( f[n << 1] ? "Yes" : "No" );
	return 0;
}