#agc038b. [agc038_b]Sorting a Segment
[agc038_b]Sorting a Segment
Problem Statement
Snuke has a permutation of .
Now, he will perform the following operation exactly once:
- Choose consecutive elements in and sort them in ascending order.
Find the number of permutations that can be produced as after the operation.
Constraints
- are all different.
- All values in input are integers.
Input
Input is given from Standard Input in the following format:
Output
Print the number of permutations that can be produced as after the operation.
Sample Input 1
5 3
0 2 1 4 3
Sample Output 1
2
Two permutations can be produced as after the operation: and .
Sample Input 2
4 4
0 1 2 3
Sample Output 2
1
Sample Input 3
10 4
2 0 1 3 7 5 4 6 8 9
Sample Output 3
6