#K40882. Shortest Unique Sequence Length

    ID: 26741 Type: Default 1000ms 256MiB

Shortest Unique Sequence Length

Shortest Unique Sequence Length

You are given a sequence of integers. Your task is to reduce the sequence by performing an operation that eliminates duplicate elements. The operation is defined in such a way that after all possible reductions, the length of the sequence becomes equal to the number of distinct elements in the original sequence.

In other words, if the sequence is given as \(a_1, a_2, \ldots, a_n\), then the answer is given by the formula:

[ \text{result} = \left| {a_1, a_2, \ldots, a_n} \right| ]

You need to process multiple test cases.

inputFormat

The input is given in stdin and has the following format:

  1. An integer \(t\) in the first line, representing the number of test cases.
  2. For each test case:
    1. An integer \(n\) representing the length of the sequence.
    2. A line with \(n\) space-separated integers representing the sequence.

outputFormat

For each test case, print a single line containing one integer: the number of distinct elements in the corresponding sequence. The output should be sent to stdout.

## sample
2
4
3 3 2 2
5
1 1 1 1 1
2

1

</p>