#include <bits/stdc++.h>
using namespace std;
template <class T>
bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
bool chmin(T &a, const T &b) {
  if (b < a) {
    a = b;
    return 1;
  }
  return 0;
}
long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
const long long LLINF = 1LL << 60;
const int INTINF = 1 << 30;
const int MOD = 1000000007;
void add(long long &a, long long b) {
  a += b;
  if (a >= MOD) a -= MOD;
}
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
const int MAX = 210;
int N, M, R;
long long dist[MAX][MAX];
int main(void) {
  cin.tie(0);
  ios::sync_with_stdio(false);
  long long N;
  cin >> N;
  vector<long long> p(N);
  for (long long i = 0, i_len = (N); i < i_len; ++i) cin >> p[i];
  int ans = 0;
  for (long long i = 0, i_len = (N - 1); i < i_len; ++i) {
    if (i + 1 == p[i]) swap(p[i], p[i + 1]), ans++;
  }
  cout << ans << endl;
}
