Chef has an array
of length . Chef wants to select some disjoint, non-empty subarrays from such that:
- The of each of the selected subarray is the same.
Note that the selected subarrays need not cover all the elements of the array.
For e.g. if , then one way in which Chef can select subarrays is as following: (Here of both of them is ).
Chef wants to select the maximum number of disjoint, non-empty subarrays that satisfy the above condition. Can you help him to do so?
Note: An array is called a subarray of an array if can be obtained from by deletion of several (possibly, zero or all) elements from the beginning and several (possibly, zero or all) elements from the end. Also, of a subarray is the smallest non-negative number that does not occur in that subarray.
Input Format
- The first line will contain - the number of test cases. Then the test cases follow.
- The first line of each test case contains a single integer - the length of the array .
- The second line of each test case contains space-separated integers - denoting the array .
Output Format
For each test case, output the maximum number of disjoint subarrays which Chef can select such that of each subarray is the same.
Constraints
- It is guaranteed that the sum of does not exceed
Sample Input 1
2
4
0 1 1 0
6
0 0 3 1 2 0
Sample Output 1
2
3
Explanation
Test case-1: Chef can select the following subarrays: , . Here . Therefore the answer is .
Test case-2: Chef can select the following subarrays: , , . Here . Therefore the answer is .
ConversionConversion EmoticonEmoticon