#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1000000007;
const long long INF = 1e16;
const long long MAX_N = 5000100;
long long gcd(long long x, long long y) { return y ? gcd(y, x % y) : x; }
long long lcm(long long x, long long y) {
  if (x == 0 || y == 0) return 0;
  return (x / gcd(x, y) * y);
}
long long fac[MAX_N], finv[MAX_N], inv[MAX_N];
void COMinit() {
  fac[0] = fac[1] = 1;
  finv[0] = finv[1] = 1;
  inv[1] = 1;
  for (int i = 2; i < MAX_N; i++) {
    fac[i] = fac[i - 1] * i % MOD;
    inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
    finv[i] = finv[i - 1] * inv[i] % MOD;
  }
}
long long COM(long long n, long long k) {
  if (n < k) return 0;
  if (n < 0 || k < 0) return 0;
  return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
long long dx[8] = {0, 0, -1, 1};
long long dy[8] = {-1, 1, 0, 0};
long long dp[101010];
long long par[101010];
long long rank2[101010];
void init(long long n) {
  for (long long i = 0; i < n; ++i) {
    par[i] = i;
    rank2[i] = 0;
  }
}
long long find(long long x) {
  if (par[x] == x) {
    return x;
  } else {
    return par[x] = find(par[x]);
  }
}
void unite(long long x, long long y) {
  x = find(x);
  y = find(y);
  if (x == y) return;
  if (rank2[x] < rank2[y]) {
    par[x] = y;
  } else {
    par[y] = x;
    if (rank2[x] == rank2[y]) {
      rank2[x]++;
    }
  }
}
long long modpow(long long a, long long n, long long mod) {
  long long res = 1;
  while (n > 0) {
    if (n & 1) res = res * a % mod;
    a = a * a % mod;
    n >>= 1;
  }
  return res;
}
bool graph[101][101];
vector<long long> to[101010];
vector<long long> ball(101010, 1);
char c[10][10];
bool visited[10][10];
char math[1010][1010];
int main() {
  long long n;
  cin >> n;
  vector<long long> p(n);
  long long ans = 0;
  for (long long i = 0; i < n; ++i) {
    cin >> p[i];
    p[i]--;
    if (p[i] == i) {
      ans++;
      i++;
    }
  }
  cout << ans << endl;
  return 0;
}
