#include <bits/stdc++.h>
using namespace std;
const long double PI = acos(-1.0);
const long long MAX = 9000000000000000000;
const long long MIN = -9000000000000000000;
const long double DMAX = 4500;
const long double DMIN = -4500;
const long long MOD = 1000000007;
template <typename T>
void fin(T a) {
  cout << a << endl;
  exit(0);
}
long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
long long ngcd(vector<long long> a) {
  long long res;
  res = a[0];
  for (long long i = 1; i < a.size() && res != 1; i++) {
    res = gcd(a[i], res);
  }
  return res;
}
long long lcm(long long a, long long b) { return a / gcd(a, b) * b; }
long long nlcm(vector<long long> numbers) {
  long long res;
  res = numbers[0];
  for (long long i = 1; i < numbers.size(); i++) {
    res = lcm(res, numbers[i]);
  }
  return res;
}
void Main() {
  long long n;
  cin >> n;
  vector<long long> p(n);
  for (long long i = 0; i < (n); ++i) cin >> p[i];
  long long flag = 0;
  if (p[0] == 1) flag = 1;
  for (long long i = 1; i < n; i++) {
    if (p[i - 1] == i && p[i] == i + 1) continue;
    if (p[i] == i + 1) flag++;
  }
  fin(flag);
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout << fixed << setprecision(20);
  Main();
  return 0;
}
