#include <bits/stdc++.h>
using namespace std;
const long long INF = 1e7 + 1;
const long long MOD = 1000000007;
const long double PI = 3.1415926;
long long int n, m, k, ans = 0, sum = 0, cnt = 0;
string s;
char c;
int main() {
  cin >> n;
  vector<long long int> v(n);
  for (long long int i = (long long int)(0); i < (long long int)(n); i++)
    cin >> v[i];
  if (v[0] == 1) {
    swap(v[0], v[1]);
    cnt++;
  }
  for (long long int i = (long long int)(0); i < (long long int)(n - 1); i++) {
    if (v[i] == i + 1) {
      swap(v[i], v[i + 1]);
      cnt++;
    }
  }
  cout << cnt << endl;
}
