#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
const ll INF = 1000000000;
const ll mod = 1000000007;
using Graph = vector<vector<int>>;
template <class T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
template <class T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
bool seen[505][505];
int dp[100050];
int main() {
  int N;
  cin >> N;
  vector<int> p(N);
  int cnt = 0;
  for (int i = 0; i < (N); i++) {
    cin >> p.at(i);
  }
  for (int i = 0; i < (N - 1); i++) {
    if (p.at(i) == i + 1) {
      swap(p.at(i), p.at(i + 1));
      cnt++;
    }
  }
  cout << cnt << endl;
  return 0;
}
