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