#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int n;
  cin >> n;
  vector<int> a(n + 1);
  vector<bool> b(n + 1);
  for (int i = 1; i <= n; i++) cin >> a[i];
  int ans = 0, i = 1, mx = 1;
  while (i <= n) {
    while (1) {
      mx = max(mx, a[i]);
      if (i == mx) {
        ans++;
        i = mx + 1;
        break;
      }
      i++;
    }
  }
  cout << ans << "\n";
  return 0;
}
