use std::vec::Vec;

fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>().split_whitespace().map(|e| e.parse().ok().unwrap()).collect()
}

fn main() {
    let n: usize = read();
    let p: Vec<usize> = read_vec();
    let mut v: Vec<bool> = vec![false; n];
    for i in 0..n {
      v[i] = (i+1 == p[i]);
    }

    let mut ans = 0;
    for i in 0..n {
      if v[i] && i < n - 1{
        ans += 1;
        v[i] = false;
        v[i+1] = false;
      }
    }

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