use proconio::{fastout, input};

#[fastout]
fn main() {
    input! {
        n: usize,
        mut p: [usize; n],
    }

    let mut count = 0;
    for i in 0..p.len() - 1 {
        if p[i] != (i + 1) {
            continue;
        };
        count += 1;
        p[i + 1] = p[i];
    }

    println!("{}", count);
}
