信奥赛基础习题集—素数问题

D. Primes Pair

单点时限: 2.0 sec

内存限制: 256 MB

We arrange the numbers between 1 and N (1 <= N <= 10000) in increasing order and decreasing order like this:

1 2 3 4 5 6 7 8 9 . . . N

N . . . 9 8 7 6 5 4 3 2 1

Two numbers faced each other form a pair. Your task is to compute the number of pairs P such that both numbers in the pairs are prime.

输入格式

The first line of input gives the number of cases, C (1 ≤ C ≤ 100). C test cases follow.

Each test case consists of an integer N in one line.

输出格式

For each test case, output P .

样例

Input
4
1
4
7
51
Output
0
2
2
6
不限期开放

积分

题目 计分
A 100
B 100
C 100
D 100
E 100
F 100
G 100
H 100
这里显示的是你在现在一次提交正确所获得的计分。