#include <bits/stdc++.h>
using namespace std;
int arr[10005];
bool readl[10005];
int read_pages(int ini) {
  int curr = ini;
  readl[ini] = 1;
  while (curr != arr[curr]) {
    curr = arr[curr];
    readl[curr] = true;
  }
  return curr;
}
int main() {
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> arr[i];
  }
  int days = 0;
  for (int i = 1; i <= n; i++) {
    int curr = read_pages(i);
    for (int j = i; j <= curr; j++) {
      if (!readl[j]) {
        curr = max(read_pages(j), curr);
      }
    }
    i = curr;
    days++;
  }
  cout << days;
}
