#include <bits/stdc++.h>
using namespace std;
int main(int argc, char const *argv[]) {
  int n;
  cin >> n;
  int tab[n + 1];
  tab[0] = 0;
  for (int i = 1; i < n + 1; i++) cin >> tab[i];
  int number = 0;
  int maxi = 0;
  for (int i = 1; i < n + 1; i++) {
    maxi = tab[i];
    for (int j = i + 1; j < n + 1; j++) {
      if (tab[maxi] >= j) maxi = tab[maxi];
      if (tab[j] == tab[i] && (maxi < j || maxi < tab[j]))
        maxi = max(j, tab[j]);
      if (maxi > j && tab[j] > maxi) maxi = tab[j];
      if (tab[maxi] >= tab[j] && j > maxi) maxi = j;
    }
    i = maxi;
    number++;
  }
  cout << number << endl;
  return 0;
}
