#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, s[100000];
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%d", &s[i]);
  }
  int ans = 0;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      if (s[j] == j + 1) {
        if (s[j] < s[j + 1]) {
          int t = s[j + 1];
          s[j + 1] = s[j];
          s[j] = t;
          ans++;
        } else {
          if (j > 0) {
            int t = s[j - 1];
            s[j - 1] = s[j];
            s[j] = t;
            ans++;
          } else {
            int t = s[j + 1];
            s[j + 1] = s[j];
            s[j] = t;
            ans++;
          }
        }
      }
    }
  }
  printf("%d\n", ans);
  return 0;
}
