import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.StringTokenizer;

public class Main {
	private static final int MOD = (int)Math.pow(10, 9);
	public static void main(String[] args) {
		FastReader sc = new FastReader();
		int n = sc.nextInt();
		int[] nums = new int[n+1];
		int cnt = 0;
		
		for (int i = 0; i < n; i++) {
			int num = sc.nextInt();
			nums[i+1] = num;
			if (num == (i+1)) { cnt++; }
		}
		
		if (cnt == 0) {
			System.out.println(cnt);
			System.exit(0);
		}
		cnt = 0;
		
		for (int i = 1; i < n; i++) {
			if (nums[i] == i || nums[i+1] == i + 1) {
				cnt++;
				int tmp = nums[i];
				nums[i] = nums[i+1];
				nums[i+1] = tmp;
			}
		}
		
		System.out.println(cnt);
	}
	
	static class FastReader {
	    BufferedReader br;
	    StringTokenizer st;
	
	    public FastReader() {
	      br = new BufferedReader(new InputStreamReader(System.in));
	    }
	  
	    String next() { 
	      while (st == null || !st.hasMoreElements()) {
	        try {
	          st = new StringTokenizer(br.readLine());
	        } catch (IOException  e) {
	          e.printStackTrace();
	        }
	      }
	      return st.nextToken();
	    }
	
	    int nextInt() {
	      return Integer.parseInt(next());
	    }
	
	    long nextLong() {
	      return Long.parseLong(next());
	    }
	
	    double nextDouble() { 
	      return Double.parseDouble(next());
	    }
	
	    String nextLine() {
	      String str = "";
	        try{
	            str = br.readLine();
	        } catch (IOException e) {
	            e.printStackTrace();
	        }
	        return str;
	      }
	  }
}
