1030: SYH’s Easy Array Problem

Memory Limit:256 MB Time Limit:2.000 S
Judge Style:Text Compare Creator:
Submit:15 Solved:2

Description

SYH has an array a1~an which has n elements. You are asked to find an array b1~bn that satisfies the following rules:

1. b1=0

2. For any pair of (i, j), if ai=aj, bi=bj. However, if aiajbi=bj is also accepted.

3. For any i which 1 ≤ i < n, either bi=bi+1 or bi+1=bi+1.

    SYH wants to know how many legal b array there are.

Input

The first line conatins an integer T, means the number of test cases. For each test case, the first line contains one integer n. The second line contains n integers a1 to an.
     

Output

For each test case ouput “Case: #x: y” in a single line. x is the test case number (starting from 1), and y is your answer. Notice, the answer may be very big, so please module 998244353 before you output it.

Sample Input Copy

2

5
1 2 1 2 3

4
1 3 3 7

Sample Output Copy

Case #1: 2
Case #2: 4

HINT

For the first sample, b=[0,0,0,0,0] or b=[0,0,0,0,1].



1 ≤ T ≤ 20, 1 ≤ n ≤ 104, 1 ≤ ai ≤ 109.