영어 원문입니다. 원문의 수식·표를 글자로 옮겨 모양이 다를 수 있습니다. 정확한 내용은 원문 페이지에서 확인하세요. 원문 페이지 열기 (새 창)
시간 제한 1초 · 메모리 제한 512 MB
Problem
You are given an array that contains each number between 1 … n 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
The first line has an integer n: the array size.
The next line has n integers x_1,x_2,…,x_n: the numbers in the array.
Output
Print one integer: the number of rounds.
Constraints
- 1 ≤ n ≤ 2 · 10^5
예제
예제 1
5 4 2 1 5 3
3