#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, arr[10002], used[10002];
  while (scanf("%d", &n) == 1) {
    for (int i = 0; i < n; i++) {
      scanf("%d", &arr[i]);
      used[i] = 0;
    }
    int count = 0;
    int cur = arr[0] - 1;
    stack<int> s;
    s.push(cur);
    while (!s.empty()) {
      cur = s.top();
      s.pop();
      int i = cur;
      int j = arr[cur] - 1;
      while (i != j) {
        if (arr[i] - 1 > j) {
          j = arr[i] - 1;
        }
        if (arr[j] - 1 > j) {
          j = arr[j] - 1;
        }
        i++;
      }
      count++;
      if (i + 1 < n) s.push(i + 1);
    }
    cout << count << endl;
  }
  return 0;
}
