시간 제한메모리 제한제출정답맞힌 사람정답 비율
9 초 768 MB211100.000%

문제

A nondecreasing subsequence $(b_1, b_2, \ldots, b_k)$ of a sequence $(a_1, a_2, \ldots, a_n)$ is said to be a maximal nondecreasing subsequence of $a$ if there is no nondecreasing subsequence $(c_1, c_2, \ldots, c_l)$ of $a$ such that $b$ is a subsequence of $c$ and $k < l$.

Given the sequence $(a_1, a_2, \ldots, a_n)$, find the length of its shortest maximal nondecreasing subsequence.

입력

The first line of input contains the number of test cases $T$. The descriptions of the test cases follow.

The description of each test case starts with a line containing one integer $n$ ($1 \le n \le 10^6$). The second line contains $n$  integers $a_1, a_2, \ldots, a_n$ ($0 \le a_i \le 10^9$).

출력

For each test case, print one integer: the length of the shortest maximal nondecreasing subsequence of the given sequence $a$.

예제 입력 1

1
5
1 2 8 4 9

예제 출력 1

4