#include <iostream>
using namespace std;

#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define REP(i, n) for (int i = 0; i < (n); i++)

bool hamming[1000000];
int main()
{
  const int c = 12960000;
  int m, n;

  REP(i, 1000000){
    if (c % (i + 1) == 0) hamming[i]++;
  }

  while (cin >> m, m){
  	cin >> n;
    int cnt = 0;
    FOR(i, m - 1, n){
      if (hamming[i]) cnt++;
    }
    cout << cnt << endl;
  }
}