#include <bits/stdc++.h>
using namespace std;
#define rep(i,n)for(int i=0;i<(n);i++)
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define pb push_back


int main(){

 int n; cin>>n;
 int a[n];

 rep(i,n)
   cin>>a[i];

   rep(i,n){

    if(a[i] == i+1){
        ans++;
        if(i == n-1) swap(a[i],a[i-1]);
        else  swap(a[i],a[i+1]); }
   }

    cout<<ans<<endl;

return 0;
}
