fn eratosthenes(n: usize) -> Vec { let mut isprime = vec![true; n + 1]; isprime[0] = false; isprime[1] = false; for i in 2..=n { if !isprime[i] { continue; } for j in 2..=n / i { isprime[j * i] = false; } } isprime } fn main() { let mut s = String::new(); std::io::stdin().read_line(&mut s).ok(); let mut iter = s.trim().split_whitespace(); let l: usize = iter.next().unwrap().parse().unwrap(); let r: usize = iter.next().unwrap().parse().unwrap(); let p = eratosthenes(r * 2); let mut ans = 0; for i in l..=r { if p[i] { ans += 1; } if i < r && p[2 * i + 1] { ans += 1; } } println!("{}", ans); }