#include <bits/stdc++.h>
using namespace std;
#define rep0(i, n) for (long long i = 0; i < (long long)(n); i++)
#define rep1(i,n) for(long long i=1;i<=(long long)(n);i++)
#define all(v) v.begin(),v.end()
typedef long long ll;

int main() {
    ll N,cnt=0;
    cin>>N;
    vector<ll> data(N);
    rep0(i,N){cin>>data.at(i);}
    rep0(i,N){
        if(data.at(i)==i+1){
            
                
                ll s=data.at();
          
                data.at()=data[i+1];
                data[i+1]=s;
                cnt++;

            
        }
    }
    cout<<cnt<<endl;
}
