#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
typedef long long ll;

int main() {
    int N; cin >> N;
    vector<int> p(N+1);
    p[0] = -1;
    for (int i = 1; i <= N; i++) {
        cin >> p[i];
    }
    int tmp = 1;
    int ans = 0;
    while (tmp <= N) {
        if (p[tmp] == tmp) {
            ans++;
            if (tmp+1 <= N)
                swap(p[tmp], p[tmp+1]);
        }
        tmp++
    }
    cout << ans << endl;
}
