#include <bits/stdc++.h>
using namespace std;
int main() {
int N; 
cin >> N; 
int A[100010] = {}; 
for(int i = 1; i <= N; i++){
int j; 
cin >> j; 
if(i == j){
A[i] = A[i-1] + 1; 
}
}
int ans = 0; 
for(int i = 1; i <= N; i++){
if(A[i+1] == 0){
ans += (A[i]+1)/2; 
}
}
cout << ans << endl; 
}