#include using namespace std; long long l, r, m = 0; bool f[2000001]; vector p = { 2 }; int main() { cin >> l >> r; for (long long i = 3; i <= r * 2; i += 2) { if (!f[i]) { p.push_back(i); for (long long j = i * i; j <= r * 2; j += i * 2) { f[j] = 1; } } } for (long long i = l; i <= r; i++) { for (long long j = i; j <= i + 2; j++) { long long n = (i + j) * (j - i + 1) / 2; bool f = 0; for (long long k : p) { if (n % k == 0) { f = 1; break; } if (k > sqrt(n)) break; } if (!f) m++; } } cout << m << endl; }