Donghyun has N cards in a row. The cards contain the distinct integers from 1 to N.
At first, he scans the row from left to right until he finds the card numbered 1, then removes it. Next, starting from the position where that card was removed, he scans to the right until he finds the card numbered 2. After removing card 2, he continues in the same way to find card 3, and repeats this process until every card has been removed.
If he reaches the right end of the row before finding the next card, he claps once and resumes the search from the left end.
Given the initial order of the cards, compute how many times Donghyun claps before the game ends.
The first line contains the number of cards, N.
Each of the next N lines contains one card number, in the initial order from left to right.
The card numbers are the integers from 1 to N, and each number appears exactly once.
Print one integer: the number of times Donghyun claps before the game ends.