100 atcoder#ABC152C. [ABC152C] Low Elements
[ABC152C] Low Elements
Score : points
Problem Statement
Given is a permutation of . Find the number of integers that satisfy the following condition:
- For any integer , .
Constraints
- is a permutation of .
- All values in input are integers.
Input
Input is given from Standard Input in the following format:
Output
Print the number of integers that satisfy the condition.
5
4 2 5 1 3
3
, , and satisfy the condition, but does not - for example, holds for . Similarly, does not satisfy the condition, either. Thus, there are three integers that satisfy the condition.
4
4 3 2 1
4
All integers satisfy the condition.
6
1 2 3 4 5 6
1
Only satisfies the condition.
8
5 7 4 2 6 8 1 3
4
1
1
1