#include <iostream>
using namespace	std;

int main() {
  int m, n;

  while(1) {
    cin << m << n;
    if(m == 0)
      break;

    int count = 0;
    for(int i = m; i <= n; i++) {
      if(i % 2 == 0)
        continue;
      else if(i % 3 == 0)
        continue;
      else if(i % 5 == 0)
        continue;
      else
        count++;
    }
    cout << count << endl;
  }
  return 0;
}
