100 atcoder#ABC132B. [ABC132B] Ordinary Number
[ABC132B] Ordinary Number
Score : points
Problem Statement
We have a permutation = {} of {}.
Print the number of elements () that satisfy the following condition:
- is the second smallest number among the three numbers , , and .
Constraints
- All values in input are integers.
- is a permutation of {}.
Input
Input is given from Standard Input in the following format:
Output
Print the number of elements () that satisfy the condition.
5
1 3 5 4 2
2
is the second smallest number among , , and . Also, is the second smallest number among , , and . These two elements satisfy the condition.
9
9 6 3 2 5 8 7 4 1
5