#[allow(unused_imports)]
use proconio::marker::{Bytes, Chars, Usize1};
use proconio::{fastout, input};
#[fastout]
fn main() {
    input! {
        n: usize,
        p: [usize; n]
    }
    let mut count = 0;
    for i in 0..n {
        if p[i] == i + 1 {
            count += 1;
            if i >= 1 && p[i - 1] == i {
                count -= 1;
            }
        }
    }
    println!("{}", count);
}
