Counting Primes in a Range

Count the primes between m and n inclusive for each blank-line separated test case.

Easy3Number theoryPrefix sumInterviewNo attempts yetTime limit1sMemory limit256 MB

Problem

You are given two integers mm and nn with 2m<n100000002 \le m < n \le 10\,000\,000.

Consider the following set.

Prime(m,n)={ppP, mpn}\mathrm{Prime}(m, n) = \{\, p \mid p \in \mathbb{P},\ m \le p \le n \,\}

Here P\mathbb{P} is the set of all primes, so Prime(m,n)\mathrm{Prime}(m, n) collects every prime that is at least mm and at most nn.

Compute the number of elements of Prime(m,n)\mathrm{Prime}(m, n).

Input

The input consists of several tests. Each test occupies one line and holds mm and nn separated by exactly one space. An empty line separates any two consecutive tests.

Output

For each test, print the number of elements of Prime(m,n)\mathrm{Prime}(m, n) on its own line, in the same order as the input. Print an empty line between any two consecutive results.