#K60332. Almost Increasing Sequence

    ID: 31063 Type: Default 1000ms 256MiB

Almost Increasing Sequence

Almost Increasing Sequence

Given a sequence of integers, determine if it is almost increasing. A sequence \(a_1, a_2, \dots, a_n\) is strictly increasing if \(a_1 < a_2 < \dots < a_n\). The sequence is considered almost increasing if it is already strictly increasing or if by removing at most one element the remaining sequence becomes strictly increasing.

For example, for the sequence [1, 3, 2, 1, 4], no single removal can make it strictly increasing, so the answer is "NO". However, for the sequence [1, 2, 10, 5], removing the element 10 results in [1, 2, 5] which is strictly increasing, so the answer is "YES".

inputFormat

The first line contains a single integer \(n\), the number of elements in the sequence. The second line contains \(n\) space-separated integers representing the sequence.

outputFormat

Print "YES" if the sequence is almost increasing, otherwise print "NO".

## sample
5
1 3 2 1 4
NO