#include using namespace std; int l, r, m = 0, N; bool f[2000001]; int main() { cin >> l >> r; f[1] = 1; N = r * 2 + 1; for (long long i = 2; i <= N; i++) { if (!f[i]) { for (long long j = i * i; j <= N; j += i) { f[j] = 1; } } } for (long long i = l; i <= r; i++) { if(!f[i]) m++; if (i < r && !f[i * 2 + 1]) m++; } cout << m << endl; }