#include <bits/stdc++.h>
using namespace std;
void init() {}
void solve() {
  int n;
  scanf("%d", &n);
  int myth[10010];
  for (int i = 0; i <= n - 1; i++) {
    scanf("%d", &myth[i]);
  }
  int ans = 0;
  set<int> un;
  for (int i = 1; i <= n; i++) {
    un.insert(myth[i - 1]);
    un.erase(i);
    if (un.size() == 0) ans++;
  }
  printf("%d\n", ans);
}
int main() {
  solve();
  return 0;
}
