#include <bits/stdc++.h>
using namespace std;
int to(int x, int y) { return (x * 60) + (y); }
long long int gcd(long long int a, long long int b) {
  return b == 0 ? a : gcd(b, a % b);
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n;
  cin >> n;
  int arr[n + 1];
  for (int i = 1; i <= n; i++) cin >> arr[i];
  int mx = 0, ans = 0;
  for (int i = 1; i <= n; i++) {
    if (arr[i] == i and mx <= i) {
      ans++;
      continue;
    }
    if (arr[i] == i) {
      continue;
    }
    mx = max(arr[i], mx);
  }
  cout << ans;
  cout << endl;
  return 0;
}
