#include <bits/stdc++.h>
using namespace std;
constexpr int INF = numeric_limits<int>::max() / 2;
constexpr long long INFL = numeric_limits<long long>::max() / 2;
constexpr int MOD = 1000000007;
using Graph = vector<vector<int>>;
int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  int ans = 0;
  int N;
  cin >> N;
  int p[N];
  for (int i = 0; i < (int)(N); i++) {
    cin >> p[i];
    if (p[i] == i + 1) ans++;
  }
  for (int i = 0; i < (int)(N - 1); i++) {
    if (p[i] == i + 1 && p[i + 1] == i + 2) ans--;
  }
  cout << ans << endl;
}
