#include <bits/stdc++.h>
using namespace std;
const int N = 20000005;
bitset<300000105> isp;
int p[N], cnt, l, r, ans;
int main() {
  scanf("%d%d", &l, &r);
  register long long x;
  for (register int i = 2; i <= r; ++i) {
    if (!isp[i]) p[++cnt] = i;
    for (register int j = 1; (x = 1ll * p[j] * i) <= r && j <= cnt; ++j) {
      isp[x] = true;
      if (!(i % p[j])) break;
    }
  }
  for (register int i = 1; i <= cnt; ++i) ans += (p[i] >= l && p[i] % 4 == 1);
  ans += (l <= 2 && r >= 2);
  printf("%d", ans);
  return 0;
}
