#include <bits/stdc++.h>
using namespace std;
long long int fastMax(long long int x, long long int y) {
  return (((y - x) >> (32 - 1)) & (x ^ y)) ^ y;
}
long long int fastMin(long long int x, long long int y) {
  return (((y - x) >> (32 - 1)) & (x ^ y)) ^ x;
}
const long long int MAXN = 1e5 + 10;
long long int a[MAXN];
void solve() {
  long long int n;
  cin >> n;
  for (long long int i = (1); i <= (n); ++i) cin >> a[i];
  string second;
  for (long long int i = (1); i <= (n); ++i)
    if (a[i] == i)
      second += '1';
    else
      second += '0';
  long long int ans = 0;
  for (long long int i = (0); i <= (n - 2); ++i) {
    if (second[i] == '1' || second[i + 1] == '1') {
      ans++;
      second[i] = '0', second[i + 1] = '0';
    }
  }
  if (second[n - 1] == '1') ans++;
  cout << ans << '\n';
}
signed main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  long long int t = 1;
  for (long long int i = (1); i <= (t); ++i) {
    solve();
  }
}
