#include <bits/stdc++.h>
using namespace std;
const int intmax = 2147483647;
const int intmin = -2147483648;
const int mod = 1000000007;
const int mod2 = 998244353;
template <typename... T>
void read(T&... args) {
  ((cin >> args), ...);
}
template <typename... T>
void print(T... args) {
  ((cout << args << " "), ...);
  cout << '\n';
}
void solve() {
  int n;
  cin >> n;
  int curr = 1;
  vector<int> v(n);
  for (int i = 0; i < n; i++) {
    cin >> v[i];
  }
  int ans = 0;
  for (int i = 0; i < n; i++) {
    ;
    ;
    curr = max(curr, v[i]);
    if (i == curr - 1) ans++, curr++;
  }
  cout << ans << '\n';
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int t;
  t = 1;
  while (t--) solve();
  return 0;
}
