#include <bits/stdc++.h>
using namespace std;
const long long INF = 1000LL * 1000 * 1000 * 1000 * 1000 * 1000;
const int inf = 1000000000 + 228;
const long double PI = acos(-1.0);
const int mod7 = 1000000000 + 7;
const int mod9 = 1000000000 + 9;
const int MAXN = 200005;
const long double EPS = 1e-10;
const int N = 300228;
long long hp = 1e6 + 3;
signed main() {
  ios_base::sync_with_stdio(0);
  cout.tie(0);
  cin.tie(0);
  ;
  long long n;
  cin >> n;
  vector<long long> a(n);
  for (long long i = 0; i < a.size(); i++) cin >> a[i];
  ;
  for (long long &i : a) i--;
  set<long long> kek;
  long long ti = 0;
  long long ans = 0;
  while (ti < n) {
    for (long long i = ti; i < a.size(); ++i) {
      kek.insert(a[i]);
      kek.erase(i);
      ti = i;
      if (!kek.size()) {
        ans++;
        break;
      }
    }
    ti++;
  }
  cout << ans;
}
