LearnPy Hub
← Arena
AdvancedRating 1700

Most Chunks to Sort (With Repeats)

Split the list into as many consecutive chunks as possible so that sorting each chunk separately and joining them gives the sorted list. Numbers may repeat. Print the number of chunks.

Input

n, then n integers.

Output

One integer.

Sample 1

Input
5
5 4 3 2 1
Output
1

Sample 2

Input
5
2 1 3 4 4
Output
4
solution.py
Output appears here
Most Chunks to Sort (With Repeats) · Python Arena problem · LearnPy Hub