#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define PI 3.14159265358979323846
constexpr int INF = numeric_limits<int>::max() / 2;
constexpr long long INFL = numeric_limits<long long>::max() / 2;
constexpr int MOD = 1000000007;
using Graph = vector<vector<int>>;



int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);

    int ans=0;
    int N;
    cin >> N;
    int p[N];
    rep(i,N) {
        cin >> p[i];
        if(p[i]==i+1) ans++;
    }
    rep(i,N-1){
        if(p[i]==i+1 && p[i+1] == i+2) {
            ans--;
            i++
        }
    }
    cout << ans << endl;



}
