#include "bits/stdc++.h"
using namespace std;

const int N = 1e5 + 5;
int in[N];

int main() {
    int n;
    scanf("%d", &n);
    for (int i = 1; i <= n; ++i) {
        cin >> in[i];
    }

    int res = 0;
    for (int i = 1; i <= n; ++i) {
        if (in[i] == i) res++, i++;
    }

    cout << res << endl;
}