#include <bits/stdc++.h>
using ll = long long;
ll min(ll a, ll b) {
  if (a >= b)
    return b;
  else
    return a;
}
ll max(ll a, ll b) {
  if (a >= b)
    return a;
  else
    return b;
}
ll gcd(ll a, ll b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
ll lcm(ll a, ll b) {
  ll g = gcd(a, b);
  return a / g * b;
}
const ll Z = 1000000007;
const ll INF = 1 << 30;
const ll INF2 = 9000000000000000000LL;
bool flag = true;
bool fl = false;
bool f = false;
bool used[210];
bool graph[100][100];
bool visited[8];
int abc[26] = {0};
int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
int main() {
  int n, a[100000], ans = 0;
  std::cin >> n;
  for (int i = 1; i <= n; i++) {
    std::cin >> a[i];
  }
  for (int i = 0; i < 100; i++) {
    for (int j = 1; j < n; j++) {
      if (a[j] == j && a[j + 1] != j) {
        int b = a[j];
        a[j] = a[j + 1];
        a[j + 1] = b;
        ans++;
      }
    }
  }
  std::cout << ans << std::endl;
}
