#C9025. Taco: Minimum Rounds

    ID: 53073 Type: Default 1000ms 256MiB

Taco: Minimum Rounds

Taco: Minimum Rounds

In this problem, you are given a sequence of Pokémon represented by integers. Your task is to determine the minimum number of rounds needed to group the Pokémon in contiguous segments such that within each segment the Pokémon are identical. In each test case, you are given an integer n and a sequence a1, a2, ..., an. The answer is calculated using the formula:

\( \text{rounds} = 1 + \sum_{i=2}^{n} \mathbf{1}_{\{a_i \neq a_{i-1}\}} \)

Output the computed number of rounds for each test case.

inputFormat

The input is read from standard input (stdin) and has the following format:

T
n1
arr1 (n1 integers separated by spaces)
...
nT
arrT (nT integers separated by spaces)

Where T is the number of test cases. For each test case, the first integer n denotes the number of Pokémon, followed by n integers representing the Pokémon sequence.

outputFormat

For each test case, output a single line containing one integer — the minimum number of rounds required to group the Pokémon.

## sample
2
5
1 2 1 2 1
7
3 3 3 3 2 2 2
5

2

</p>