#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  while (cin >> n) {
    int num[100010];
    for (int i = 1; i <= n; i++) scanf("%d", &num[i]);
    int ans = 0;
    for (int i = 1; i <= n;) {
      if (num[i] == i) {
        ans++;
        if (i % 2) {
          swap(num[i], num[i + 1]);
          i += 2;
          continue;
        } else {
          swap(num[i - 1], num[i]);
          i++;
          continue;
        }
      }
      i++;
    }
    cout << ans << endl;
  }
}
