#include <bits/stdc++.h>
using namespace std;
int generate_random() {
  const int MAX_RANDOM = (int)1e6;
  mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
  return uniform_int_distribution<int>(0, MAX_RANDOM)(rng);
}
const long long INFLL = 2 * (long long)1e18 + 100;
const long long INFINT = INFLL;
const double PI = atan(1) * 4;
const double EPS = 1e-6;
const long long SEED = (long long)1e3 + 7;
const long long MOD = (long long)1e9 + 7;
const long long NMAX = (long long)1e5 + 5;
int32_t main() {
  srand(time(0));
  cout << setprecision(20) << fixed;
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long n;
  cin >> n;
  long long cur_page = 0;
  deque<long long> mistere;
  long long days = 0;
  for (long long i = 1; i <= n; i++) {
    long long a;
    cin >> a;
    mistere.push_back(a);
    cur_page = i;
    while (mistere.size() && cur_page >= mistere.front()) {
      mistere.pop_front();
    }
    if (!mistere.size()) days++;
  }
  cout << days;
  return 0;
}
