Chef received an array
of integers as a valentine's day present. He wants to maximize the length of the longest strictly increasing subsequence by choosing a subarray and adding a fixed integer to all its elements.
More formally, Chef wants to maximize the length of the longest strictly increasing subsequence of by performing the following operation at most once:
- Pick integers and and assign .
Find the length of the longest strictly increasing sequence Chef can obtain after performing the operation at most once.
Input Format
- The first line of the input contains a single integer denoting the number of test cases. The description of test cases follows.
- The first line of each test case contains one integer , the size of the array.
- The next line contains space-separated integers, where the integer denotes .
Output Format
For each test case, print a single line containing one integer ― the length of the longest strictly increasing sequence Chef can obtain.
Constraints
- Sum of over all test cases does not exceed .
Sample Input 1
3
3
1 2 1
5
1 5 8 6 9
4
1 2 2 1
Sample Output 1
3
5
3
Explanation
Test case : Chef can pick . On performing the operation, becomes . The LIS of the updated array has length . The elements of the LIS are .
Test case : Chef can pick . On performing the operation, becomes . The LIS of the updated array has length . The elements of the LIS are .
Test case : Chef can pick . On performing the operation, becomes . The LIS of the updated array has length . The elements of the LIS are .
ConversionConversion EmoticonEmoticon