Jonathan is writing a problem for the GlobeX Canada Cup. However, he lost his ideas for the first problems of the junior division. So, Jonathan is making a problem about the numbers he loves the most: prime numbers. A good number is defined as an integer such that it is prime, and the sum of its digits is also prime. A number
is prime if it only has two divisors,
and itself (
).
Given a list of integers, find out how many of them are good numbers.
Input Specification
The first line will contain the integer
, the number of integers to test.
The next lines will each contain an integer,
, the integer to test.
Output Specification
On the first line, output one integer, the number of good numbers in the list.
Constraints
Subtask 1 [30%]
Subtask 2 [70%]
No additional constraints.
Sample Input
3
3
23
51
Sample Output
2
Comments