import std.algorithm;
import std.array;
import std.conv;
import std.math;
import std.range;
import std.stdio;
import std.string;
import std.typecons;

int readint() {
    return readln.chomp.to!int;
}

int[] readints() {
    return readln.split.map!(to!int).array;
}

int calc(int[] xs) {
    int ans = 0;
    for (int i = 0; i + 1 < xs.length; i++) {
        if (xs[i] == i + 1) { 
            ans++;
            swap(xs[i], xs[i + 1]);
        }
    }

    if (xs[$ - 1] == xs.length)
        ans++;

    return ans;
}

void main() {
    readint;
    auto xs = readints;
    writeln(calc(xs));
}
