#D2764. Derangement
Derangement
Derangement
You are given a permutation p_1,p_2,...,p_N consisting of 1,2,..,N. You can perform the following operation any number of times (possibly zero):
Operation: Swap two adjacent elements in the permutation.
You want to have p_i ≠ i for all 1≤i≤N. Find the minimum required number of operations to achieve this.
Constraints
- 2≤N≤10^5
- p_1,p_2,..,p_N is a permutation of 1,2,..,N.
Input
The input is given from Standard Input in the following format:
N p_1 p_2 .. p_N
Output
Print the minimum required number of operations
Examples
Input
5 1 4 3 5 2
Output
2
Input
2 1 2
Output
1
Input
2 2 1
Output
0
Input
9 1 2 4 9 5 8 7 3 6
Output
3
inputFormat
Input
The input is given from Standard Input in the following format:
N p_1 p_2 .. p_N
outputFormat
Output
Print the minimum required number of operations
Examples
Input
5 1 4 3 5 2
Output
2
Input
2 1 2
Output
1
Input
2 2 1
Output
0
Input
9 1 2 4 9 5 8 7 3 6
Output
3
样例
5
1 4 3 5 2
2