#P3423. Collecting Numbers

Collecting Numbers

当前没有测试数据。

Description

You are given an array that contains each number between 1n exactly once. Your task is to collect the numbers from 1 to n in increasing order.

On each round, you go through the array from left to right and collect as many numbers as possible. What will be the total number of rounds?

Input Format

The first line has an integer n: the array size.

The next line has n integers x1,x2,,xn: the numbers in the array.

Output Format

Print one integer: the number of rounds.
5
4 2 1 5 3
3

Hint

1n2105

Source

CSES