#include <bits/stdc++.h>
using namespace std;
long long i, n, m, k, x, z, c, a[500007], b[500007], ans, bad, total;
int main() {
  cin >> n;
  for (i = 1; i <= n; i++) cin >> a[i];
  set<long long> st;
  for (i = 1; i <= n; i++) {
    st.insert(a[i]);
    if (st.find(i) != st.end()) st.erase(i);
    if (st.size() == 0) c++;
  }
  cout << c << endl;
  return 0;
}
