#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int N, P[100009];
  cin >> N;
  for (long long int i = 1; i <= N; i++) {
    cin >> P[i];
  }
  long long int Y = 0;
  for (long long int i = 1; i + 1 <= N; i += 2) {
    if (P[i] == i || P[i + 1] == i + 1) Y++;
  }
  cout << Y << endl;
  return 0;
}
