#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<long long> v;
  for (int i = 0; i < n; i++) {
    int p;
    cin >> p;
    v.push_back(p);
  }
  map<long long, long long> mp;
  long long mn = 0;
  sort(v.begin(), v.end());
  for (int i = 0; i < n; i++) {
    if ((i + 1) == v[i]) {
      mn++;
    }
  }
  cout << mn << endl;
}
