#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
const long long int INF = 2147483647;
const long long int MINF = -2147483648;
const long long int LINF = 9223372036854775807;
const long long int MOD = 1000000007;
const double PI = acos(-1);
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vlli = vector<long long int>;
using vvli = vector<vlli>;
using vs = vector<string>;
using vvs = vector<vs>;
using vb = vector<bool>;
using vvb = vector<vb>;
using ll = long long;
template <typename T>
istream &operator>>(istream &is, vector<T> &vec) {
  for (T &x : vec) is >> x;
  return is;
}
template <typename T>
ostream &operator<<(ostream &os, vector<T> &vec) {
  for (int i = 0; i < vec.size(); i++) {
    os << vec[i] << (i + 1 == vec.size() ? "" : "");
  }
  return os;
}
template <typename T>
bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <typename T>
bool chmin(T &a, const T &b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
long long int a = 0, b = 0, c = 0, h = 0, n = 0, w = 0, ans = 0, count = 0;
string s = "", t = "";
vector<pair<long long int, long long int>> pr;
map<long long int, long long int> make_pair;
set<long long int> st;
long long int solve() {
  long long int a = 0, b = 0, c = 0, h = 0, n = 0, w = 0, ans = 0, count = 0;
  string s = "", t = "";
  vector<pair<long long int, long long int>> pr;
  map<long long int, long long int> make_pair;
  set<long long int> st;
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  cin >> n;
  vlli d(n), e(n);
  for (long long int i = 0; i < (n); i++) {
    cin >> d[i];
    e[i] = d[i];
  }
  for (long long int i = 0; i < (n - 1); i++) {
    if (e[i] == i + 1) {
      e[i] = a;
      e[i] = e[i + 1];
      e[i + 1] = a;
      ans++;
    }
  }
  for (long long int i = 0; i < (n - 1); i++) {
    if (e[i] == i + 1) {
      e[i] = a;
      e[i] = e[i + 1];
      e[i + 1] = a;
      ans++;
    }
  }
  for (long long int i = 0; i < (n - 1); i++) {
    if (e[i] == i + 1) {
      e[i] = a;
      e[i] = e[i + 1];
      e[i + 1] = a;
      ans++;
    }
  }
  for (long long int i = 0; i < (n - 1); i++) {
    if (e[i] == i + 1) {
      e[i] = a;
      e[i] = e[i + 1];
      e[i + 1] = a;
      ans++;
    }
  }
  for (long long int i = 0; i < (n - 1); i++) {
    if (e[i] == i + 1) {
      e[i] = a;
      e[i] = e[i + 1];
      e[i + 1] = a;
      ans++;
    }
  }
  for (long long int i = 0; i < (n - 1); i++) {
    if (e[i] == i + 1) {
      e[i] = a;
      e[i] = e[i + 1];
      e[i + 1] = a;
      ans++;
    }
  }
  for (long long int i = 0; i < (n - 1); i++) {
    if (e[i] == i + 1) {
      e[i] = a;
      e[i] = e[i + 1];
      e[i + 1] = a;
      ans++;
    }
  }
  for (long long int i = 0; i < (n - 1); i++) {
    if (e[i] == i + 1) {
      e[i] = a;
      e[i] = e[i + 1];
      e[i + 1] = a;
      ans++;
    }
  }
  for (long long int i = 0; i < (n - 1); i++) {
    if (e[i] == i + 1) {
      e[i] = a;
      e[i] = e[i + 1];
      e[i + 1] = a;
      ans++;
    }
  }
  for (long long int i = 0; i < (n - 1); i++) {
    if (e[i] == i + 1) {
      e[i] = a;
      e[i] = e[i + 1];
      e[i + 1] = a;
      ans++;
    }
  }
  for (long long int i = 0; i < (n - 1); i++) {
    if (e[i] == i + 1) {
      e[i] = a;
      e[i] = e[i + 1];
      e[i + 1] = a;
      ans++;
    }
  }
  for (long long int i = 0; i < (n - 1); i++) {
    if (e[i] == i + 1) {
      e[i] = a;
      e[i] = e[i + 1];
      e[i + 1] = a;
      ans++;
    }
  }
  for (long long int i = 0; i < (n - 1); i++) {
    if (e[i] == i + 1) {
      e[i] = a;
      e[i] = e[i + 1];
      e[i + 1] = a;
      ans++;
    }
  }
  for (long long int i = 0; i < (n - 1); i++) {
    if (e[i] == i + 1) {
      e[i] = a;
      e[i] = e[i + 1];
      e[i + 1] = a;
      ans++;
    }
  }
  for (long long int i = 0; i < (n - 1); i++) {
    if (e[i] == i + 1) {
      e[i] = a;
      e[i] = e[i + 1];
      e[i + 1] = a;
      ans++;
    }
  }
  for (long long int i = 0; i < (n - 1); i++) {
    if (e[i] == i + 1) {
      e[i] = a;
      e[i] = e[i + 1];
      e[i + 1] = a;
      ans++;
    }
  }
  for (long long int i = 0; i < (n - 1); i++) {
    if (e[i] == i + 1) {
      e[i] = a;
      e[i] = e[i + 1];
      e[i + 1] = a;
      ans++;
    }
  }
  for (long long int i = 0; i < (n - 1); i++) {
    if (e[i] == i + 1) {
      e[i] = a;
      e[i] = e[i + 1];
      e[i + 1] = a;
      ans++;
    }
  }
  for (long long int i = 0; i < (n - 1); i++) {
    if (e[i] == i + 1) {
      e[i] = a;
      e[i] = e[i + 1];
      e[i + 1] = a;
      ans++;
    }
  }
  for (long long int i = 0; i < (n - 1); i++) {
    if (e[i] == i + 1) {
      e[i] = a;
      e[i] = e[i + 1];
      e[i + 1] = a;
      ans++;
    }
  }
  for (long long int i = 0; i < (n - 1); i++) {
    if (e[i] == i + 1) {
      e[i] = a;
      e[i] = e[i + 1];
      e[i + 1] = a;
      ans++;
    }
  }
  for (long long int i = 0; i < (n - 1); i++) {
    if (e[i] == i + 1) {
      e[i] = a;
      e[i] = e[i + 1];
      e[i + 1] = a;
      ans++;
    }
  }
  for (long long int i = 0; i < (n - 1); i++) {
    if (e[i] == i + 1) {
      e[i] = a;
      e[i] = e[i + 1];
      e[i + 1] = a;
      ans++;
    }
  }
  for (long long int i = 0; i < (n - 1); i++) {
    if (e[i] == i + 1) {
      e[i] = a;
      e[i] = e[i + 1];
      e[i + 1] = a;
      ans++;
    }
  }
  for (long long int i = 0; i < (n - 1); i++) {
    if (e[i] == i + 1) {
      e[i] = a;
      e[i] = e[i + 1];
      e[i + 1] = a;
      ans++;
    }
  }
  for (long long int i = 0; i < (n - 1); i++) {
    if (e[i] == i + 1) {
      e[i] = a;
      e[i] = e[i + 1];
      e[i + 1] = a;
      ans++;
    }
  }
  for (long long int i = 0; i < (n - 1); i++) {
    if (e[i] == i + 1) {
      e[i] = a;
      e[i] = e[i + 1];
      e[i + 1] = a;
      ans++;
    }
  }
  for (long long int i = 0; i < (n - 1); i++) {
    if (e[i] == i + 1) {
      e[i] = a;
      e[i] = e[i + 1];
      e[i + 1] = a;
      ans++;
    }
  }
  for (long long int i = 0; i < (n - 1); i++) {
    if (e[i] == i + 1) {
      e[i] = a;
      e[i] = e[i + 1];
      e[i + 1] = a;
      ans++;
    }
  }
  for (long long int i = 0; i < (n - 1); i++) {
    if (e[i] == i + 1) {
      e[i] = a;
      e[i] = e[i + 1];
      e[i + 1] = a;
      ans++;
    }
  }
  for (long long int i = 0; i < (n - 1); i++) {
    if (e[i] == i + 1) {
      e[i] = a;
      e[i] = e[i + 1];
      e[i + 1] = a;
      ans++;
    }
  }
  for (long long int i = 0; i < (n - 1); i++) {
    if (e[i] == i + 1) {
      e[i] = a;
      e[i] = e[i + 1];
      e[i + 1] = a;
      ans++;
    }
  }
  for (long long int i = 0; i < (n - 1); i++) {
    if (e[i] == i + 1) {
      e[i] = a;
      e[i] = e[i + 1];
      e[i + 1] = a;
      ans++;
    }
  }
  for (long long int i = 0; i < (n - 1); i++) {
    if (e[i] == i + 1) {
      e[i] = a;
      e[i] = e[i + 1];
      e[i + 1] = a;
      ans++;
    }
  }
  for (long long int i = 0; i < (n - 1); i++) {
    if (e[i] == i + 1) {
      e[i] = a;
      e[i] = e[i + 1];
      e[i + 1] = a;
      ans++;
    }
  }
  for (long long int i = 0; i < (n - 1); i++) {
    if (e[i] == i + 1) {
      e[i] = a;
      e[i] = e[i + 1];
      e[i + 1] = a;
      ans++;
    }
  }
  for (long long int i = 0; i < (n - 1); i++) {
    if (e[i] == i + 1) {
      e[i] = a;
      e[i] = e[i + 1];
      e[i + 1] = a;
      ans++;
    }
  }
  for (long long int i = 0; i < (n - 1); i++) {
    if (e[i] == i + 1) {
      e[i] = a;
      e[i] = e[i + 1];
      e[i + 1] = a;
      ans++;
    }
  }
  for (long long int i = 0; i < (n - 1); i++) {
    if (e[i] == i + 1) {
      e[i] = a;
      e[i] = e[i + 1];
      e[i + 1] = a;
      ans++;
    }
  }
  for (long long int i = 0; i < (n - 1); i++) {
    if (e[i] == i + 1) {
      e[i] = a;
      e[i] = e[i + 1];
      e[i + 1] = a;
      ans++;
    }
  }
  for (long long int i = 0; i < (n - 1); i++) {
    if (e[i] == i + 1) {
      e[i] = a;
      e[i] = e[i + 1];
      e[i + 1] = a;
      ans++;
    }
  }
  for (long long int i = 0; i < (n - 1); i++) {
    if (e[i] == i + 1) {
      e[i] = a;
      e[i] = e[i + 1];
      e[i + 1] = a;
      ans++;
    }
  }
  for (long long int i = 0; i < (n - 1); i++) {
    if (e[i] == i + 1) {
      e[i] = a;
      e[i] = e[i + 1];
      e[i + 1] = a;
      ans++;
    }
  }
  for (long long int i = 0; i < (n - 1); i++) {
    if (e[i] == i + 1) {
      e[i] = a;
      e[i] = e[i + 1];
      e[i + 1] = a;
      ans++;
    }
  }
  for (long long int i = 0; i < (n - 1); i++) {
    if (e[i] == i + 1) {
      e[i] = a;
      e[i] = e[i + 1];
      e[i + 1] = a;
      ans++;
    }
  }
  for (long long int i = 0; i < (n - 1); i++) {
    if (e[i] == i + 1) {
      e[i] = a;
      e[i] = e[i + 1];
      e[i + 1] = a;
      ans++;
    }
  }
  for (long long int i = 0; i < (n - 1); i++) {
    if (e[i] == i + 1) {
      e[i] = a;
      e[i] = e[i + 1];
      e[i + 1] = a;
      ans++;
    }
  }
  for (long long int i = 0; i < (n - 1); i++) {
    if (e[i] == i + 1) {
      e[i] = a;
      e[i] = e[i + 1];
      e[i + 1] = a;
      ans++;
    }
  }
  for (long long int i = 0; i < (n - 1); i++) {
    if (e[i] == i + 1) {
      e[i] = a;
      e[i] = e[i + 1];
      e[i + 1] = a;
      ans++;
    }
  }
  for (long long int i = 0; i < (n - 1); i++) {
    if (e[i] == i + 1) {
      e[i] = a;
      e[i] = e[i + 1];
      e[i + 1] = a;
      ans++;
    }
  }
  for (long long int i = 0; i < (n - 1); i++) {
    if (e[i] == i + 1) {
      e[i] = a;
      e[i] = e[i + 1];
      e[i + 1] = a;
      ans++;
    }
  }
  for (long long int i = 0; i < (n - 1); i++) {
    if (e[i] == i + 1) {
      e[i] = a;
      e[i] = e[i + 1];
      e[i + 1] = a;
      ans++;
    }
  }
  for (long long int i = 0; i < (n - 1); i++) {
    if (e[i] == i + 1) {
      e[i] = a;
      e[i] = e[i + 1];
      e[i + 1] = a;
      ans++;
    }
  }
  for (long long int i = 0; i < (n - 1); i++) {
    if (e[i] == i + 1) {
      e[i] = a;
      e[i] = e[i + 1];
      e[i + 1] = a;
      ans++;
    }
  }
  for (long long int i = 0; i < (n - 1); i++) {
    if (e[i] == i + 1) {
      e[i] = a;
      e[i] = e[i + 1];
      e[i + 1] = a;
      ans++;
    }
  }
  for (long long int i = 0; i < (n - 1); i++) {
    if (e[i] == i + 1) {
      e[i] = a;
      e[i] = e[i + 1];
      e[i + 1] = a;
      ans++;
    }
  }
  for (long long int i = 0; i < (n - 1); i++) {
    if (e[i] == i + 1) {
      e[i] = a;
      e[i] = e[i + 1];
      e[i + 1] = a;
      ans++;
    }
  }
  for (long long int i = 0; i < (n - 1); i++) {
    if (e[i] == i + 1) {
      e[i] = a;
      e[i] = e[i + 1];
      e[i + 1] = a;
      ans++;
    }
  }
  for (long long int i = 0; i < (n - 1); i++) {
    if (e[i] == i + 1) {
      e[i] = a;
      e[i] = e[i + 1];
      e[i + 1] = a;
      ans++;
    }
  }
  for (long long int i = 0; i < (n - 1); i++) {
    if (e[i] == i + 1) {
      e[i] = a;
      e[i] = e[i + 1];
      e[i + 1] = a;
      ans++;
    }
  }
  for (long long int i = 0; i < (n - 1); i++) {
    if (e[i] == i + 1) {
      e[i] = a;
      e[i] = e[i + 1];
      e[i + 1] = a;
      ans++;
    }
  }
  for (long long int i = 0; i < (n - 1); i++) {
    if (e[i] == i + 1) {
      e[i] = a;
      e[i] = e[i + 1];
      e[i + 1] = a;
      ans++;
    }
  }
  for (long long int i = 0; i < (n - 1); i++) {
    if (e[i] == i + 1) {
      e[i] = a;
      e[i] = e[i + 1];
      e[i + 1] = a;
      ans++;
    }
  }
  for (long long int i = 0; i < (n - 1); i++) {
    if (e[i] == i + 1) {
      e[i] = a;
      e[i] = e[i + 1];
      e[i + 1] = a;
      ans++;
    }
  }
  for (long long int i = 0; i < (n - 1); i++) {
    if (e[i] == i + 1) {
      e[i] = a;
      e[i] = e[i + 1];
      e[i + 1] = a;
      ans++;
    }
  }
  for (long long int i = 0; i < (n - 1); i++) {
    if (e[i] == i + 1) {
      e[i] = a;
      e[i] = e[i + 1];
      e[i + 1] = a;
      ans++;
    }
  }
  for (long long int i = 0; i < (n - 1); i++) {
    if (e[i] == i + 1) {
      e[i] = a;
      e[i] = e[i + 1];
      e[i + 1] = a;
      ans++;
    }
  }
  for (long long int i = 0; i < (n - 1); i++) {
    if (e[i] == i + 1) {
      e[i] = a;
      e[i] = e[i + 1];
      e[i + 1] = a;
      ans++;
    }
  }
  for (long long int i = 0; i < (n - 1); i++) {
    if (e[i] == i + 1) {
      e[i] = a;
      e[i] = e[i + 1];
      e[i + 1] = a;
      ans++;
    }
  }
  for (long long int i = 0; i < (n - 1); i++) {
    if (e[i] == i + 1) {
      e[i] = a;
      e[i] = e[i + 1];
      e[i + 1] = a;
      ans++;
    }
  }
  for (long long int i = 0; i < (n - 1); i++) {
    if (e[i] == i + 1) {
      e[i] = a;
      e[i] = e[i + 1];
      e[i + 1] = a;
      ans++;
    }
  }
  for (long long int i = 0; i < (n - 1); i++) {
    if (e[i] == i + 1) {
      e[i] = a;
      e[i] = e[i + 1];
      e[i + 1] = a;
      ans++;
    }
  }
  for (long long int i = 0; i < (n - 1); i++) {
    if (e[i] == i + 1) {
      e[i] = a;
      e[i] = e[i + 1];
      e[i + 1] = a;
      ans++;
    }
  }
  for (long long int i = 0; i < (n - 1); i++) {
    if (e[i] == i + 1) {
      e[i] = a;
      e[i] = e[i + 1];
      e[i + 1] = a;
      ans++;
    }
  }
  for (long long int i = 0; i < (n - 1); i++) {
    if (e[i] == i + 1) {
      e[i] = a;
      e[i] = e[i + 1];
      e[i + 1] = a;
      ans++;
    }
  }
  for (long long int i = 0; i < (n - 1); i++) {
    if (e[i] == i + 1) {
      e[i] = a;
      e[i] = e[i + 1];
      e[i + 1] = a;
      ans++;
    }
  }
  for (long long int i = 0; i < (n - 1); i++) {
    if (e[i] == i + 1) {
      e[i] = a;
      e[i] = e[i + 1];
      e[i + 1] = a;
      ans++;
    }
  }
  for (long long int i = 0; i < (n - 1); i++) {
    if (e[i] == i + 1) {
      e[i] = a;
      e[i] = e[i + 1];
      e[i + 1] = a;
      ans++;
    }
  }
  for (long long int i = 0; i < (n - 1); i++) {
    if (e[i] == i + 1) {
      e[i] = a;
      e[i] = e[i + 1];
      e[i + 1] = a;
      ans++;
    }
  }
  for (long long int i = 0; i < (n - 1); i++) {
    if (e[i] == i + 1) {
      e[i] = a;
      e[i] = e[i + 1];
      e[i + 1] = a;
      ans++;
    }
  }
  for (long long int i = 0; i < (n - 1); i++) {
    if (e[i] == i + 1) {
      e[i] = a;
      e[i] = e[i + 1];
      e[i + 1] = a;
      ans++;
    }
  }
  for (long long int i = 0; i < (n - 1); i++) {
    if (e[i] == i + 1) {
      e[i] = a;
      e[i] = e[i + 1];
      e[i + 1] = a;
      ans++;
    }
  }
  for (long long int i = 0; i < (n - 1); i++) {
    if (e[i] == i + 1) {
      e[i] = a;
      e[i] = e[i + 1];
      e[i + 1] = a;
      ans++;
    }
  }
  for (long long int i = 0; i < (n - 1); i++) {
    if (e[i] == i + 1) {
      e[i] = a;
      e[i] = e[i + 1];
      e[i + 1] = a;
      ans++;
    }
  }
  for (long long int i = 0; i < (n - 1); i++) {
    if (e[i] == i + 1) {
      e[i] = a;
      e[i] = e[i + 1];
      e[i + 1] = a;
      ans++;
    }
  }
  for (long long int i = 0; i < (n - 1); i++) {
    if (e[i] == i + 1) {
      e[i] = a;
      e[i] = e[i + 1];
      e[i + 1] = a;
      ans++;
    }
  }
  for (long long int i = 0; i < (n - 1); i++) {
    if (e[i] == i + 1) {
      e[i] = a;
      e[i] = e[i + 1];
      e[i + 1] = a;
      ans++;
    }
  }
  for (long long int i = 0; i < (n - 1); i++) {
    if (e[i] == i + 1) {
      e[i] = a;
      e[i] = e[i + 1];
      e[i + 1] = a;
      ans++;
    }
  }
  for (long long int i = 0; i < (n - 1); i++) {
    if (e[i] == i + 1) {
      e[i] = a;
      e[i] = e[i + 1];
      e[i + 1] = a;
      ans++;
    }
  }
  for (long long int i = 0; i < (n - 1); i++) {
    if (e[i] == i + 1) {
      e[i] = a;
      e[i] = e[i + 1];
      e[i + 1] = a;
      ans++;
    }
  }
  for (long long int i = 0; i < (n - 1); i++) {
    if (e[i] == i + 1) {
      e[i] = a;
      e[i] = e[i + 1];
      e[i + 1] = a;
      ans++;
    }
  }
  for (long long int i = 0; i < (n - 1); i++) {
    if (e[i] == i + 1) {
      e[i] = a;
      e[i] = e[i + 1];
      e[i + 1] = a;
      ans++;
    }
  }
  for (long long int i = 0; i < (n - 1); i++) {
    if (e[i] == i + 1) {
      e[i] = a;
      e[i] = e[i + 1];
      e[i + 1] = a;
      ans++;
    }
  }
  for (long long int i = 0; i < (n - 1); i++) {
    if (e[i] == i + 1) {
      e[i] = a;
      e[i] = e[i + 1];
      e[i + 1] = a;
      ans++;
    }
  }
  for (long long int i = 0; i < (n - 1); i++) {
    if (e[i] == i + 1) {
      e[i] = a;
      e[i] = e[i + 1];
      e[i + 1] = a;
      ans++;
    }
  }
  for (long long int i = 0; i < (n - 1); i++) {
    if (e[i] == i + 1) {
      e[i] = a;
      e[i] = e[i + 1];
      e[i + 1] = a;
      ans++;
    }
  }
  for (long long int i = 0; i < (n - 1); i++) {
    if (e[i] == i + 1) {
      e[i] = a;
      e[i] = e[i + 1];
      e[i + 1] = a;
      ans++;
    }
  }
  for (long long int i = 0; i < (n - 1); i++) {
    if (e[i] == i + 1) {
      e[i] = a;
      e[i] = e[i + 1];
      e[i + 1] = a;
      ans++;
    }
  }
  for (long long int i = 0; i < (n - 1); i++) {
    if (e[i] == i + 1) {
      e[i] = a;
      e[i] = e[i + 1];
      e[i + 1] = a;
      ans++;
    }
  }
  for (long long int i = 0; i < (n - 1); i++) {
    if (e[i] == i + 1) {
      e[i] = a;
      e[i] = e[i + 1];
      e[i + 1] = a;
      ans++;
    }
  }
  for (long long int i = 0; i < (n - 1); i++) {
    if (e[i] == i + 1) {
      e[i] = a;
      e[i] = e[i + 1];
      e[i + 1] = a;
      ans++;
    }
  }
  for (long long int i = 0; i < (n - 1); i++) {
    if (e[i] == i + 1) {
      e[i] = a;
      e[i] = e[i + 1];
      e[i + 1] = a;
      ans++;
    }
  }
  for (long long int i = 0; i < (n - 1); i++) {
    if (e[i] == i + 1) {
      e[i] = a;
      e[i] = e[i + 1];
      e[i + 1] = a;
      ans++;
    }
  }
  for (long long int i = 0; i < (n - 1); i++) {
    if (e[i] == i + 1) {
      e[i] = a;
      e[i] = e[i + 1];
      e[i + 1] = a;
      ans++;
    }
  }
  for (long long int i = 0; i < (n - 1); i++) {
    if (e[i] == i + 1) {
      e[i] = a;
      e[i] = e[i + 1];
      e[i + 1] = a;
      ans++;
    }
  }
  for (long long int i = 0; i < (n - 1); i++) {
    if (e[i] == i + 1) {
      e[i] = a;
      e[i] = e[i + 1];
      e[i + 1] = a;
      ans++;
    }
  }
  return ans;
}
signed main() { cout << solve() << '\n'; }
