Problem: You are given an integer array of length . A subarray of is one of its contiguous subsequences (i. e. an array for some integers and such that ). Let's call a subarray unique if there is an integer that occurs exactly once in the subarray.
You can perform the following operation any number of times (possibly zero): choose an element of the array and replace it with any integer.
Your task is to calculate the minimum number of aforementioned operation in order for all the subarrays of the array to be unique.
Input Format: The first line contains a single integer () — the number of test cases.
The first line of each test case contains a single integer ().
The second line contains integers ().
Additional constraint on the input: the sum of over all test cases doesn't exceed .
Output Format: For each test case, print a single integer — the minimum number of aforementioned operation in order for all the subarrays of the array to be unique.
Note: In the second test case, you can replace the -st and the -rd element, for example, like this: .
In the third test case, you can replace the -th element, for example, like this: .