#include <bits/stdc++.h>
using namespace std;
int dx[] = {0, 1, 1, 1, 0, -1, -1, -1};
int dy[] = {-1, -1, 0, 1, 1, 1, 0, -1};
const long long MOD = 1000000007;
const long long INF = 1000000;
const int MAX = 10000000;
int p[10005];
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> p[i];
    p[i]--;
  }
  int ans = 0;
  for (int i = 0; i < n - 1; i++) {
    if (p[i] != i) continue;
    swap(p[i], p[i + 1]);
    ans++;
  }
  if (p[n - 1] == n - 1) ans++;
  cout << ans << endl;
}
