import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner scan = new Scanner(System.in);
        int N = scan.nextInt();
        
        boolean[] shouldSwap = new boolean[N];
        
        for(int i = 0; i < N; i++) {
            int p = scan.nextInt();
            shouldSwap[i] = (p == i+1 ? true : false);
        }
        
        int swapCount = 0;
        for(int i = 0; i < N; i++) {
            if(i == N-1 && shouldSwap[i]) {
                swapCount++;
                shouldSwap[i] = false;
            } else if(shouldSwap[i] && shouldSwap[i+1]) {
                swapCount++;
                shouldSwap[i] = false;
                shouldSwap[i+1] = false;
            } else if(shouldSwap[i]) {
                swapCount++;
                shouldSwap[i] = false;
            }
        }
        
        System.out.println(swapCount);
    }
}
