#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <utility>
#include <set>
#include <map>
#include <cmath>
#include <queue>
#include <cstdio>
#include <limits>
#define rep(i,n) for(int i = 0; i < n; ++i)
#define rep1(i,n) for(int i = 1; i <= n; ++i)
using namespace std;
template<class T>bool chmax(T &a, const T &b) { if(a < b){ a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if(a > b){ a = b; return 1; } return 0; }
template<class T> inline int  sz(T &a) { return a.size(); }
using ll = long long; using ld = long double;
using pi = pair<int,int>; using pl = pair<ll,ll>;
using vi = vector<int>; using vvi = vector<vi>;
using vl = vector<ll>; using vvl = vector<vl>;
const int inf = numeric_limits<int>::max();
const ll infll = numeric_limits<ll>::max();
int main()
{
  int n; cin >> n;
  vi x(n),y(n);
  rep(i,n) cin >> x[i] >> y[i];

  int res = 0;
  rep(i,n) {
    rep(j,n) {
      if(i >= j) continue;
      int dx = abs(x[i] - x[j]), dy = abs(y[i] - y[j]);
      if(dy <= dx) res++;
    }
  }
  cout << res << "\n";
  return 0;
}

#include <bits/stdc++.h>
#define int long long
using namespace std;
using vec_int = vector<int>;
using P = pair<int,int>;
using T = tuple<int,int,int>;
using ll = long long;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)

signed main()
{
    int A, B; cin>>A>>B;
    vec_int primes = {2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71};
    int diff = B-A+1;

    vector<vec_int> DP(diff+1, vec_int((1<<20), 0));
    DP.at(0).at(0) = 1;

    for(int i=0;i<diff;i++){
        int num = A+i;

        int state = 0;
        for(int j=0;j<20;j++){
            if(num%primes.at(j)==0)state+=(1<<j);
        }

        for(int j=0;j<(1<<20);j++){
            DP.at(i+1).at(j) += DP.at(i).at(j);
            if((j&state)==0){
                DP.at(i+1).at(j+state) += DP.at(i).at(j);
            }
        }
    }
    int result = 0;
    for(int j=0;j<(1<<20);j++){
        result += DP.at(diff).at(j);
    }
    cout<<result<<endl;



    return 0;
}