#K5141. Minimum Books Removal

    ID: 29081 Type: Default 1000ms 256MiB

Minimum Books Removal

Minimum Books Removal

You are given a sequence of integer values representing the sizes of books placed in order on a shelf. Your task is to remove the minimum number of books so that the remaining sequence is strictly increasing.

Formally, given a sequence \(A = [a_1, a_2, \dots, a_n]\), you need to find the length of the longest strictly increasing subsequence (LIS), denoted by \(L\). The answer to the problem is \(n - L\), which is the minimum number of removals required to make the sequence strictly increasing.

Input/Output: All input is read from standard input and output is printed to standard output.

Example:

Input:
5
1 3 2 4 5

Output: 1

</p>

inputFormat

The first line contains a single integer \(n\) indicating the number of books. The second line contains \(n\) space-separated integers denoting the sizes of the books in the given order.

outputFormat

Print a single integer which is the minimum number of books that need to be removed to make the sequence strictly increasing.

## sample
5
1 3 2 4 5
1