#include<iostream>
#include<algorithm>
using namespace std;

int main()
{
int N, p[100000], cnt = 0;
bool pc[100000];
cin >> N:
for(int i = 1; i <= N; i++) cin >> p[i];
for(int i = 1; i <= N; i++){
if(p[i] == i){
pc[i] = false;
}else{
pc[i] = true;
}
if(pc[i] == false) swap(p[i], p[i + 1]), cnt++;
}
cout << cnt << endl;
return 0;
}