#include <bits/stdc++.h>
using namespace std;
const int MAXN = 10001;
vector<int> cola;
int n, data[MAXN];
bool check(int x) {
  sort(cola.begin(), cola.end());
  if (cola[cola.size() - 1] == x) {
    return true;
  }
  return false;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  for (int i = 1; i < n + 1; i++) {
    cin >> data[i];
  }
  int indice = 1, ans = 0;
  while (indice <= n) {
    cola.push_back(data[indice]);
    if (check(indice)) {
      ans++;
      cola.clear();
    }
    indice++;
  }
  cout << ans << endl;
}
