#include <bits/stdc++.h>
using ll = long long;
using namespace std;
template <class T>
bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
bool chmin(T &a, const T &b) {
  if (b < a) {
    a = b;
    return 1;
  }
  return 0;
}
int main() {
  int n;
  cin >> n;
  vector<int> p(n);
  int cnt = 0;
  for (ll i = 0; i < n; i++) {
    cin >> p[i];
    if (p[i] == i + 1) cnt++;
  }
  if (cnt)
    cout << cnt - 1;
  else
    cout << cnt;
  cout << "\n";
  return 0;
}
