#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using VI = vector<int>;
using VL = vector<ll>;
constexpr ll INF = 1000000000;
constexpr ll LLINF = 1LL << 60;
constexpr ll mod = 1000000007;
constexpr ll MOD = 998244353;
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;
}
inline void init() {
  cin.tie(nullptr);
  cout.tie(nullptr);
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(15);
}
template <class T>
inline istream& operator>>(istream& input, vector<T>& v) {
  for (auto& elemnt : v) input >> elemnt;
  return input;
}
int main() {
  init();
  int n;
  cin >> n;
  VI p(n);
  for (int(i) = (0); (i) < (n); (i)++) {
    cin >> p[i];
    p[i]--;
  }
  int ans = 0;
  for (int(i) = (0); (i) < (n - 1); (i)++) {
    if (p[i] == i) {
      swap(p[i], p[i + 1]);
      ans++;
    }
  }
  cout << ans << "\n";
}
