#include <bits/stdc++.h>
using namespace std;
bool dd[100001];
int main() {
  int n;
  cin >> n;
  int a[100001];
  for (int i = 1; i <= n; i++) cin >> a[i];
  int res = 0;
  int cnt = 0;
  for (int i = 1; i <= n; i++) {
    dd[i] = 1;
    if (dd[a[i]] == 0) {
      cnt = max(a[i], cnt);
    } else {
      if (i >= cnt) res++;
    }
  }
  cout << res;
  return 0;
}
