#include using namespace std; #define rep(i,n) for(int i=0;i smalls(s); for (int i = 1; i < s; ++i) smalls[i] = i; vector roughs(s); for (int i = 0; i < s; ++i) roughs[i] = 2 * i + 1; vector larges(s); for (int i = 0; i < s; ++i) larges[i] = (N / (2 * i + 1) - 1) / 2; vector skip(v + 1); const auto divide = [] (i64 n, i64 d) -> int { return double(n) / d; }; const auto half = [] (int n) -> int { return (n - 1) >> 1; }; int pc = 0; for (int p = 3; p <= v; p += 2) if (!skip[p]) { int q = p * p; if (i64(q) * q > N) break; skip[p] = true; for (int i = q; i <= v; i += 2 * p) skip[i] = true; int ns = 0; for (int k = 0; k < s; ++k) { int i = roughs[k]; if (skip[i]) continue; i64 d = i64(i) * p; larges[ns] = larges[k] - (d <= v ? larges[smalls[d >> 1] - pc] : smalls[half(divide(N, d))]) + pc; roughs[ns++] = i; } s = ns; for (int i = half(v), j = ((v / p) - 1) | 1; j >= p; j -= 2) { int c = smalls[j >> 1] - pc; for (int e = (j * p) >> 1; i >= e; --i) smalls[i] -= c; } ++pc; } larges[0] += i64(s + 2 * (pc - 1)) * (s - 1) / 2; for (int k = 1; k < s; ++k) larges[0] -= larges[k]; for (int l = 1; l < s; ++l) { int q = roughs[l]; i64 M = N / q; int e = smalls[half(M / q)] - pc; if (e < l + 1) break; i64 t = 0; for (int k = l + 1; k <= e; ++k) t += smalls[half(divide(M, roughs[k]))]; larges[0] += t - i64(e - l) * (pc + l - 1); } return larges[0] + 1; } signed main(){ lint l,r;cin>>l>>r; lint res=prime_pi(r)-prime_pi(l-1); res+=prime_pi(r*2)-prime_pi(l*2); cout<