
import java.util.Scanner;
import java.util.Arrays;

class Main{
        public static void main(String[] args){
                Scanner scanner=new Scanner(System.in);
                int N=scanner.nextInt();
                boolean[] a=new boolean[N];
                for(int i=0;i<N;i++){
                        if(i+1==scanner.nextInt()){
                                a[i]=true;
                        }else{
                                a[i]=false;
                        }
                }
                int ans=0;
                int i=0;
                for(;i<N-1;i++){
                        if(a[i]){
                                ans++;
                                if(a[i+1]){
                                        i++;
                                }
                        }
                }
                if(i==N-1 && a[i]){
                        ans++;
                }
                System.out.println(ans);
        }
}