#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  int n, i, cnt;
  cin >> n;
  vector<int> a(n + 1);
  for (i = 1; i <= n; i++) cin >> a[i];
  i = 1;
  cnt = 0;
  set<int> s;
  set<int>::iterator it;
  while (i <= n) {
    s.insert(a[i]);
    it = s.lower_bound(i + 1);
    while (i <= n && it != s.end()) {
      i++;
      s.insert(a[i]);
      it = s.lower_bound(i + 1);
    }
    cnt++;
    i++;
  }
  cout << cnt << "\n";
  return 0;
}
