import std.stdio, std.string, std.conv, std.bigint, std.typecons, std.algorithm, std.array, std.math, std.range, std.functional;
 
void main() {
    auto N = readln.chomp.to!long;
    auto x = readln.split.to!(long[]);
    long cnt = 0;
    foreach (i; 0..N) {
        if (x[i] == i+1) {
            cnt++;
            swap(x[i], x[i+1]);
        }
    }
    writeln(cnt);
}
