#include <bits/stdc++.h>
using namespace std;
long long n, a[1000005], res = 0;
int main() {
  cin >> n;
  for (long long i = 1; i <= n; i++) cin >> a[i];
  for (long long i = 1; i <= n; i = i + 2) {
    if (a[i] == i || a[i + 1] == i + 1) res++;
  }
  if (n % 2 == 1 && a[n] == n) res++;
  cout << res;
}
