#include <bits/stdc++.h>
int main(void) {
  int n;
  scanf("%d", &n);
  int a[n + 1];
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  int days = 0;
  int i = 1;
  while (i <= n) {
    if (a[i] == i) {
      days++;
      i++;
    } else if (a[i] > i) {
      int index = a[i];
      while (i <= index && i <= n) {
        i++;
        if (a[i] > index) index = a[i];
        if (i == index) {
          i++;
          days++;
          break;
        }
      }
    }
  }
  printf("%d\n", days);
  return (0);
}
