#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  long long n = 0, m = 0, mn = 0, mx = 0, l = 1, r = 0, k = 0, j = 1, i = 0,
            ans = 0;
  cin >> n;
  vector<int> a(n);
  for (auto &x : a) cin >> x;
  bool got = true;
  while (got) {
    while (i < l) {
      if (a[i] > l) {
        l = a[i];
      }
      i++;
    }
    l = i + 1;
    m++;
    if (l == n + 1) {
      break;
    }
  }
  cout << m << endl;
}
