import std.stdio, std.array, std.string, std.conv, std.algorithm;
import std.typecons, std.range, std.random, std.math, std.container;
import std.numeric, std.bigint, core.bitop, core.stdc.string;

immutable long MOD = 10^^9 + 7;

void main() {
    auto N = readln.chomp.to!int;
    auto A = readln.split.map!(to!int).array;

    int ans = 0;
    int tmp = 0;

    foreach (i; 0..N) {
        tmp = max(tmp, A[i]);
        if (i + 1 == tmp) ans += 1, tmp = 0;
    }

    ans.writeln;
}
