#include <bits/stdc++.h>
using namespace std;
int main(){
int n;cin>>n;int ans=0;vector<int>x(n);
for(int i=0;i<n;++i)cin>>x[i];for(int i=0;i<n-1;++i)if(x[i]==i+1){swap(x[i],x[i+1]);++ans;}if(x[n-1]==n)++ans;
  cout<<ans;cout<<endl;
  return 0;}