Petriukas has a deck of n cards. Each card contains an integer from 1 to 100,000 inclusive. The numbers on the cards may repeat.
Petriukas decided to sort the cards. To do this, he picks the top card from the deck and if the number on it is the smallest number among all the cards in this deck, he puts it aside. Otherwise, he places it at the bottom of the deck and picks the next top card. The process ends when the deck has no more cards left. Petriukas has played this game many times, so he always knows what the smallest number in the remaining deck is.
Help determine how many times Petriukas needs to pick the top card.
Input
The first line contains an integer n (1 \le n \le 10^5).
The second line contains n integers a_i (1 \le a_i \le 10^5).
Output
Print the answer.
Examples
standard input | standard output |
---|
4
6 3 1 2
| 7
|
1
6
| 1
|
3
2 2 2
| 3
|