Limits 1s, 512 MB

Don’t worry! If you are a programmer, you might not have arithmophobia!! But Era has a weird phobia and doesn’t like numbers unless it is a palindromic prime number. Era has a good friend Noel, who wants to surprise Era with a bunch of balloons written palindromic prime numbers. Unfortunately, Noel doesn’t know about these numbers. Now Noel wants you to find these numbers.

A number is a prime number if it is greater than 1 and has exactly 2 divisors which are 1 and the number itself. 

You are given a range of numbers. Find out all prime numbers in that range inclusively. Among these prime numbers print the count of the number which is also a Palindromic number.

Input consists of two integer l (1 <= l <= 5 * 10^7 ) and r (1 <= r <= 5 * 10^7)
Print the count of palindromic prime numbers in the given range

Input

130 160

Output

2

Sample

InputOutput
130 160
2

Explanation:
In the range of {130 – 160}, prime numbers are (131 137 139 149 151 157), among these prime numbers Palindromic numbers are (131 151).

Submit

Login to submit.

Statistics

67% Solution Ratio
Agony_BringerEarliest, 2M ago
Nayma16Fastest, 0.1s
Nayma16Lightest, 5.2 MB
FahimRShortest, 597B
Toph uses cookies. By continuing you agree to our Cookie Policy.