#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  int arr[10000];
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
  }
  int answer = 0;
  int last = arr[0];
  for (int i = 0; i < n; i++) {
    last = max(last, arr[i]);
    if (arr[i] == i + 1 && i + 1 == last) {
      answer++;
    }
  }
  cout << answer;
}
