#include <bits/stdc++.h>
using namespace std;
random_device _random_device;
default_random_engine _generator(_random_device());
uniform_int_distribution<long long unsigned> _distribution(0,
                                                           0xFFFFFFFFFFFFFFFF);
inline long long unsigned get_random_number() {
  return _distribution(_generator);
}
template <class T>
bool uin(T &a, T b) {
  return a > b ? (a = b, true) : false;
}
template <class T>
bool uax(T &a, T b) {
  return a < b ? (a = b, true) : false;
}
inline long long nxt() {
  long long x;
  cin >> x;
  return x;
}
namespace aux {
vector<string> split(const string &s, char c) {
  vector<string> v;
  stringstream ss(s);
  string x;
  while (getline(ss, x, c)) {
    v.emplace_back(x);
  }
  return v;
}
}  // namespace aux
int n;
int p[100500];
int main() {
  ios::sync_with_stdio(false);
  n = nxt();
  for (int i = 0; i < n; ++i) p[i + 1] = nxt();
  int ans = 0;
  if (p[1] == 1) swap(p[1], p[2]), ans++;
  for (int i = 2; i <= n; ++i) {
    if (p[i] == i) ans++, swap(p[i], p[i - 1]);
  }
  cout << ans << endl;
  return 0;
}
