403051: GYM100985 B MaratonIME plays Cîrokime

Memory Limit:64 MB Time Limit:1 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

B. MaratonIME plays Cîrokimetime limit per test1 secondmemory limit per test64 megabytesinputstandard inputoutputstandard outputHave you ever seen flavored vodka?Everaldo, Glauber

The MaratonIME members like to have fun. As they enjoy having fun so much, they have invented a game named "Cîrokime". The game works as follows:

First, n cups with Cîroc1 are lined up. In front of the i-th cup a number ai is written. It is guaranteed that ai < ai + 1, for all 1 ≤ i < n. Then, the numbers are covered and the game starts.

The player must then find the cup that has a certain number x. It is guaranteed that this cup exists. For this, he has to choose a cup i and drink the beverage. Then, the cup's number ai is revealed and if this number is equal to x the game finished. Otherwise, the player has to choose another cup and so on.

"Cîrokime" is a traditional game among MaratonIME members, they play it every party. At the last party, Sussu had to drink all of the n cups because he found the right cup only at the end. He got sick for drinking so much and had to be carried home3

However, the DESMAME4 is scheduled for May 13 and Sussu wants to restore his dignity. For this, he wants to know, in the worst case, what is the maximum number of cups that he will have to drink if he plays in the optimal way.

Input

The first line has a single integer n, the number of cups. The second line has n integers ai, the values hidden in each cup.

  • 1 ≤ n ≤ 105
  • For all i, 1 ≤ ai ≤ 109
  • For i < n, ai < ai + 1
Output

The output has a single line with a single integer: the minimum number of cups that Sussu should drink, in the worst case, if he plays in the optimal way.

ExamplesInput
3
2 5 7
Output
2
Input
8
1 2 3 4 5 6 7 8
Output
4
Note

1: Cîroc is a vodka brand made in France, known by its high sales price in market2

2: Balalaika also works

3: Based on real facts

4: Pre-BIFE5 party

5: University games that IME6 attends

6: Institute of Mathematics and Statistics

加入题单

算法标签: