#include <iostream>
#include <fstream>
#include <vector>
#include <cstring>
#include <algorithm> // sort

#define REP(i, n) for (long long i = 0; i < (n); i++) 
typedef long long ll;
static const ll MOD = 1000000007;
static const ll INF = 1000000000000000000LL;
using namespace std;

//imos
int main(){
    ll n;
    cin >> n;

    ll p[n+1] = {};
    REP(i,n)
    {
        cin >> p[i];
        --p[i];
    }

    ll res = 0;

    REP(i,n)
    {
        if(i == p[i])
        {
            if(i+1 = p[i+1])
            {
                ++res;
                ++i;//skip
            }
            else
            {
                ++res;
            }
        }
    }

    cout << res << endl;

    return 0;    
}

