#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp> // Common file
//#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
#include <stdio.h>
#include <cassert>
using namespace std;
//using namespace __gnu_pbds;
typedef long long lo;
typedef pair<lo,lo> ll;//pair
typedef vector<lo> vl;  //vector of long
typedef vector<ll > vll;   //vector of pair
typedef priority_queue<lo>p_q;
typedef vector< vl > vvl;  //vector of vectors
#define X first
#define Y second
#define mp(a,b) make_pair((a),(b))
#define REP(a,b) for(lo i=(a);i<(lo)b;i++)//no need to declare variable i
#define REPE(a,b,c,d) REP(a,b)for(lo j=(c);j<(lo)d;j++)//no need to declare vaiables i,j
#define REPV(a,b,c) for((a)=b;(a)<(c);(a)++)//a is the variable
#define IREP(a,b) for(lo i=(a);i>=(b);i--)
#define IREPV(a,b,c) for((a)=b;(a)>=(c);(a)--)
#define all(v) (v).begin(),(v).end()
#define TRV(a) for(auto it : a)
#define INF 100005
#define MOD 1000000007
#define CHECK_BIT(var,pos) ((var) & (1<<(pos)))
#define pb(a) push_back((a))/*
//order statistic tree
typedef
tree<
  lo,
    null_type,
  less_equal<lo>,
  rb_tree_tag,
  // This policy updates nodes' metadata for order statistics.
  tree_order_statistics_node_update>
ordered_set;
*/
/*#define gc getchar_unlocked
#define pc putchar_unlocked
inline void sprlo( lo a){
    lo i=0;
    char S[20];
    if(a==0)pc('0');
    if(a<0){
        pc('-');
        a*=-1;
    }
    while(a>0){
        S[i++]=a%10+'0';
        a=a/10;
    }
    --i;
    while(i>=0)
    pc(S[i--]);
    pc(' ');
}
inline void lprlo( lo a){
    lo i=0;
    char S[20];
    if(a==0)pc('0');
    while(a>0){
        S[i++]=a%10+'0';
        a=a/10;
    }
    --i;
    while(i>=0)
    pc(S[i--]);
    pc('\n');
}
inline lo uscan(){
    lo n=0;
    char c=gc();
    while(c<'0'||c>'9')c=gc();
    while(c<='9'&&c>='0'){
	    n=n*10+c-'0';
	    c=gc();
	}
    return n;
}*/
template<typename T> ostream& operator<< ( ostream &o,vector<T> v ) {
    if ( v.size() >0 )o<<v[0];
    for ( unsigned   i=1; i<v.size(); i++ )o<<" "<<v[i];
    return o<<endl;
}
template<typename U,typename V> ostream& operator<< ( ostream &o,pair<U,V> p ) {
    return o<<"("<<p.first<<", "<<p.second<<") ";
}
template<typename T> istream& operator>> ( istream &in,vector<T> &v ) {
    for ( unsigned   i=0; i<v.size(); i++ )in>>v[i];
    return in;
}
template<typename T> istream& operator>> ( istream &in,pair <T,T> &p ) {
    in>>p.X;
    in>>p.Y;
    return in;
}
/*
vector<vll>dp(INF,vll(50,mp(MOD,MOD)));
vvl a(INF,vl(50));
vvl b(INF,vl(50));

bool compare(ll x,ll y){
    if(x.X<y.X)return true;
    if(x.Y<y.Y)return true;
    return false;
}
lo n,m,k;
ll dijkstra(ll node){
   set <pair< ll,ll> > pq;  ///prev node weight <curr node curr node mask>
   pq.insert(mp(mp(0,0),node));
   dp[node.X][node.Y]=mp(0,0);
   while(!pq.empty()){
        auto t=*pq.begin();
        pq.erase(t);
        lo x=t.Y.X;
        lo y=t.Y.Y;
        lo dis=t.X.X;
        lo tim=t.X.Y;
        if(x==n)return t.X;
        if(y-1>=0)if(compare(mp(dis,tim+b[x][y-1]), dp[x][y-1])){
            pq.erase(mp(dp[x][y-1],mp(x,y-1)));
            dp[x][y-1]=mp(dis,tim+b[x][y-1]);
            pq.insert(mp(dp[x][y-1],mp(x,y-1)));
        }
        if(y+1<m)if(compare(mp(dis,tim+b[x][y]), dp[x][y+1])){
            pq.erase(mp(dp[x][y+1],mp(x,y+1)));
            dp[x][y+1]=mp(dis,tim+b[x][y]);
            pq.insert(mp(dp[x][y+1],mp(x,y+1)));
        }
        if(x-1>=0)if(compare(mp(dis+a[x-1][y],tim), dp[x-1][y])){
            pq.erase(mp(dp[x-1][y],mp(x-1,y)));
            dp[x-1][y]=mp(dis+a[x-1][y],tim);
            pq.insert(mp(dp[x-1][y],mp(x-1,y)));
        }
        if(y+1<=n)if(compare(mp(dis+a[x][y],tim), dp[x+1][y])){
            pq.erase(mp(dp[x+1][y],mp(x+1,y)));
            dp[x+1][y]=mp(dis+a[x][y],tim);
            pq.insert(mp(dp[x+1][y],mp(x+1,y)));
        }
   }
   return mp(-1,-1);
}*/
vl tree(4*INF,0);
void update(lo node,lo start,lo end, lo idx,lo val){
    if(start == end)tree[node] = val;
    else{
        lo mid = (start + end) / 2;
        if(start <= idx and idx <= mid)update(2*node+1, start, mid, idx, val);
        else update(2*node+2, mid+1, end, idx, val);
        // Internal node will have the sum of both of its children
        tree[node] = max(tree[2*node+1] ,tree[2*node+2]);
    }
}
lo query(lo node, lo start, lo end, lo l, lo r){
    if(r < start or end < l)return 0;
    if(l <= start and end <= r)return tree[node];
    // range represented by a node is partially inside and partially outside the given range
    lo mid = (start + end) / 2;
    lo p1 = query(2*node+1, start, mid, l, r);
    lo p2 = query(2*node+2, mid+1, end, l, r);
    return max(p1, p2);
}
#define endl "\n"
int main(){
    std::ios::sync_with_stdio(false);
    lo n;
    cin>>n;
    vl a(n);
    cin>>a;
    lo ans=0;
    REP(0,n-1)if(a[i]==i+1){
        swap(a[i],a[i+1]);
        ans++;
    }
    if(a[n-1]==n)ans++;
    cout<<ans;
    return 0;
}


Measured memory_bytes: 4224