#include <iostream>
#include <algorithm>

using namespace std;

int p[100'000];

int main()
{
    int N;
    cin >> N;

    for (int i = 0; i < N; i++)
    {
        cin >> p[i];
        p[i]--;
    }

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

    cout << cnt << endl;
}