#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 9;
int n, a[N];
int main() {
  while (~scanf("%d", &n)) {
    for (int i = 1; i <= n; i++) {
      scanf("%d", &a[i]);
    }
    a[n + 1] = -1;
    int cnt = 0;
    for (int i = 1; i <= n; i += 2) {
      if (a[i] == i && a[i + 1] == i + 1) {
        cnt++;
      } else if (a[i] == i && a[i + 1] != i + 1) {
        cnt++;
      } else {
        continue;
      }
    }
    printf("%d\n", cnt);
  }
  return 0;
}
