#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using pii = pair<int, int>;
const ll LINF = 0x1fffffffffffffff;
const int INF = 0x3fffffff;
const int MOD = 1000000007;
void in() {}
template <class T, class... U>
void in(T &t, U &...u) {
  cin >> t;
  in(u...);
}
void solve();
int main() {
  cin.tie(0);
  ios::sync_with_stdio(0);
  solve();
}
void solve() {
  int N;
  in(N);
  vector<int> p(N);
  for (auto &x : (p)) in(x);
  int ans = 0;
  for (int i = (0); i < (N - 1); ++i) {
    if (p[i] == i + 1) {
      swap(p[i], p[i + 1]);
      ans++;
    }
  }
  cout << (ans) << endl;
}
