Given a permutation of 1 to n, you need to perform some operations to make it into increasing order. Each operation is to reverse an interval (a prefix). Your goal is to minimize the number of operations.
Input
The first line contains an integer ().
The second line contains space separated integers, representing the sequence .
Output
An integer representing the answer, that is, the minimum number of operations needed to make the permutation into increasing order.
A possible way is to reverse , and then .