The Missing Permutation

No attempts yetTime limit15sMemory limit256 MB

Problem

Little Tomato keeps a permutation PP of the numbers 11 through nn on a board. Every day he swaps a few numbers of PP to get a new permutation PP', then looks for the longest increasing subsequence (LIS) of PP'. He believes that he will eventually find a faster way to compute an LIS.

One day an earthquake shook some of the numbers off the board. Every fallen number goes back into an empty slot, and Tomato picks which slot each one lands in. How long can the LIS of the restored permutation be?

An increasing subsequence is a subsequence whose values grow from left to right.

Input

The first line contains the number of test cases TT (1T1001 \le T \le 100).

Each test case starts with a line holding the length nn of the permutation (1n1051 \le n \le 10^5). The next line holds the incomplete permutation a1,a2,,ana_1, a_2, \dots, a_n. If ai=0a_i = 0, the number that sat at position ii has fallen off.

The input is always valid. The nonzero values are distinct and lie between 11 and nn, and the fallen numbers are exactly the values of 11 through nn that do not appear. The whole input is smaller than 10MB.

Output

For each test case, print the largest possible length of the LIS of the restored permutation on its own line.