401487: GYM100482 G Pairs

Memory Limit:256 MB Time Limit:1 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

G. Pairstime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard output

The pair in the land of 1000000007 is the pair of numbers a and b with the following relation: a × b = 1 (mod 1000000007). It is believed to be the sign of divine. Your task is to increase the number of happy marriages so you must find the maximum number of distinct pairs! Distinct pairs can not have the same number (with the same index). Pairs are different when the sets of their indices are different

Input

The first line contains the number of test cases T (T ≤ 5). The first line of each test case contains the size of population, n (1 ≤ n ≤ 30000). The following n lines contain the numbers ai (1 ≤ ai < 1000000007).

Output

For each test case output one line containing “Case #tc: num”, where tc is the number of the test case (starting from 1) and num is the maximum number of distinct pairs.

ExamplesInput
1
5
1
1
1
2
500000004
Output
Case #1: 2

加入题单

算法标签: