2570. 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

740 人解决,855 人已尝试。

1087 份提交通过,共有 2446 份提交。

1.1 EMB 奖励。

创建: 15 年,7 月前.

修改: 7 年,2 月前.

最后提交: 1 月,3 周前.

来源: 2009 华东师范大学 研究生复试

题目标签