LIS#6378

LIS

2 seconds
64 megabytes
Very hard

Mr. C is interested with Longest Increasing Subsequence problem. Given a sequence S = s_1, s_2, \ldots, s_n. The Longest Increasing Subsequence is the subsequence L = l_1, l_2, \ldots, l_k of such that l_1 < l_2 < \ldots < l_k.

Given a sequence , find the total length of of every consecutive subsequence (subsequence which elements are consecutive in the original sequence) of with non zero length!

Input

The first line of input consists of an integer denotes the number of cases. It is followed by blocks, each representing a case.

The first line of each case contains an integers: (1 \leq n \leq 500), the length of .

The next lines each consists of an integer s_i (1 \leq s_i \leq n) denoting the -th element of . Each element of is unique.

Output

Output consists of lines, each describes the solution for each case with the same order as in input.

Each case consists of a single line with the format "Case #i: S", where represents the case number and represents the total length of of every consecutive subsequence of .

Examples

Example 1

Loading
Loading