#include <bits/stdc++.h>
using namespace std;
bool f(int x) {
  if (x == 1) return false;
  bool res = true;
  for (int i = 2; i <= sqrt(x); ++i) {
    if (x % i == 0) {
      res = false;
      break;
    }
  }
  return res;
}
int main() {
  int a, b, cnt;
  cin >> a >> b;
  cnt = 0;
  for (int i = b; i <= a; i++) {
    if (f(i)) cnt++;
  }
  cout << cnt << endl;
  return 0;
}
