Farmer John is trying to sort his cows, conveniently numbered from to , before they head out to the pastures for breakfast.
Currently, the cows are standing in a line in the order p_1, p_2, \ldots, p_n, and Farmer John is standing in front of cow p_1. He wants to reorder the cows so that they stand in the order 1, 2, \ldots, n, with cow closest to Farmer John.
The cows are a bit sleepy today, so at any moment the only cow paying attention to Farmer John's instructions is the cow directly facing him. In one time step, he can instruct this cow to move positions down the line, for any integer with 1 \le k \le n - 1. The cows she passes each move one step forward, making room for her to take her place right behind them.
For example, suppose that n = 4 and the cows start in the following order:
FJ: 4, 3, 2, 1The only cow paying attention to Farmer John is cow . If he instructs her to move positions down the line, the order becomes:
FJ: 3, 2, 4, 1Now the only cow paying attention to Farmer John is cow , so in the second time step he can give an instruction to cow , and so on, until the cows are sorted.
Farmer John is eager to finish sorting so that he can return to the farmhouse for his own breakfast. Help him find the minimum number of time steps required to sort the cows.
The first line contains an integer n~(1 \le n \le 100) — the number of cows.
The second line contains distinct integers p_1, p_2, \ldots, p_n~(1 \le p_i \le n) — the initial order of the cows.
Print one integer — the minimum number of time steps required to sort all cows if Farmer John acts optimally.
Example 1