import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		int times = 0;
		Scanner scanner = new Scanner(System.in);
		int N = scanner.nextInt();
		int[] plist = new int[N];
		for (int i = 0; i < N; i++) {
			plist[i] = scanner.nextInt();
	    }
	    
	    for (int i = 0; i < N; i++) {
	    	if (i == 0 && plist[i] == 1) {
	    		swap(0, 1, plist);
	    		times++;
	    	} else if (i == N-1 && plist[i] == N) {
	    		swap(N-1, N-2, plist);
	    		times++;
	    	} else if (plist[i] == i+1) {
	    		if (plist[i-1] != i) {
	    			swap(i, i-1, plist);
	    			times++;
	    		} else {
	    			swap(i, i+1, plist);
	    			times++;
	    		}
	    	}
	    }
	    
	   System.out.println(times);
	   }
	   
   public static void swap(int a, int b, int[] list) {
   		int temp;
   		temp = list[a];
   		list[a] = list[b];
   		list[b] = temp;
   }
 } 
		