#include <bits/stdc++.h>
using namespace std;
const int max_n = 1e5;
const long long mod = 1e9 + 7;
const long long INF = 1LL << 60;
const int inf = 1e5;
template <class T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
int dx[4] = {0, 0, 1, -1};
int dy[4] = {1, -1, 0, 0};
long long mo = 998244353;
struct UnionFind {
  vector<int> par;
  UnionFind(int n) : par(n, -1) {}
  void init(int n) { par.assign(n, -1); }
  int root(int x) {
    if (par[x] < 0)
      return x;
    else
      return par[x] = root(par[x]);
  }
  bool issame(int x, int y) { return root(x) == root(y); }
  bool merge(int x, int y) {
    x = root(x);
    y = root(y);
    if (x == y) return false;
    if (par[x] > par[y]) swap(x, y);
    par[x] += par[y];
    par[y] = x;
    return true;
  }
  int size(int x) { return -par[root(x)]; }
};
int main() {
  int n;
  cin >> n;
  vector<int> v(n);
  int cnt = 0;
  for (long long i = 0; i < n; i++) cin >> v[i];
  for (long long i = 0; i < n - 1; i++) {
    if (v[i] == i + 1) {
      swap(v[i], v[i + 1]);
      cnt++;
    }
  }
  if (v.back() + 1 == n) cnt++;
  cout << cnt << endl;
  return 0;
}
