import java.util.Scanner;

class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int[] a = new int[n];
    for (int i = 0; i < n; i++) {
      a[i] = sc.nextInt();
    }
    
    int count = 0;
    for (int i = 0; i < a.length; i++) {
      if (a[i] == i + 1 && i == a.length - 1) {
        int swap = a[i];
        a[i] = a[i - 1];
        a[i - 1] = swap;
        count++;
      }
      if (a[i] == i + 1) {
        int swap = a[i];
        a[i] = a[i + 1];
        a[i + 1] = swap;
        count++;
      }
    }
    System.out.println(count);
  }
}
