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

int main()
{
    int n, p[100010];
    cin >> n;
    for (int i = 0; i < n; i++) cin >> p[i];

    int cnt = 0;
    for (int i = 0; i < n; i++) {
        if (p[i] == i + 1) swap(p[i], p[i + 1]), cnt++;
    }

    cout << cnt << endl;

    return 0;
}
