#include <bits/stdc++.h>
using namespace std;
int M[100][100];
int color[100];
const int TABLEMAX = 510000;
const int MOD = 1000000007;
long long fac[TABLEMAX], finv[TABLEMAX], inv[TABLEMAX];
const int ddx[8] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const int dx[4] = {0, 1, 0, -1};
const int dy[4] = {-1, 0, 1, 0};
static const int NIL = -1;
vector<pair<long long, long long>> prime_factor;
vector<long long> factor_list;
long long n;
template <class X>
void printArray(X *array, long long);
template <class X>
void printVector(vector<X> &v);
template <class X>
void printDimention(vector<vector<X>> &dv);
template <class X>
void printMap(X);
template <class X>
void printVecPair(vector<X> &v);
long long factor2(long long);
long long combination(int, int);
int factorial(int, int);
int find_digits(int);
int findSumOfDigits(int);
int degree(int);
int shishagonyu(double);
int roundUp(double);
int roundDown(double);
int roundOff(double);
int gcd(int, int);
long long lcm(long long, long long);
void prime_factorization(long long);
int Eratosthenes(int);
bool odd_even(int);
long long modinv(long long, long long);
long long modpow(long long, long long, long long);
void COMinit();
long long COM(int, int);
long long abs_ll(long long);
long long div_one(long long, long long);
template <class X>
void StringtoVec(string, vector<X> &v);
void get_factor_list(long long);
int main(int argc, char const *argv[]) {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >> n;
  vector<long long> a(n);
  for (long long i = (0); i < (n); ++i) {
    cin >> a[i];
    a[i]--;
  }
  long long cnt = 0;
  for (long long i = (0); i < (n); ++i) {
    if (i == a[i]) {
      swap(a[i], a[i + 1]);
      cnt++;
    }
  }
  cout << cnt << endl;
  return 0;
}
template <class X>
void printArray(X array[], long long n) {
  for (long long i = (0); i < (n); ++i) {
    if (i) cout << " ";
    cout << array[i];
  }
  cout << endl;
}
template <class X>
void printVector(vector<X> &v) {
  for (long long i = (0); i < ((int)v.size()); ++i) {
    if (i) cout << " ";
    cout << v[i];
  }
  cout << endl;
}
template <class X>
void printDimention(vector<vector<X>> &dv) {
  for (long long i = (0); i < ((long long)dv.size()); ++i) {
    for (long long j = (0); j < ((long long)dv[i].size()); ++j) {
      if (j) cout << " ";
      cout << dv[i][j];
    }
    cout << endl;
  }
}
template <class X>
void printMap(X mp) {
  for (auto it : mp) {
    cout << it.first << " " << it.second << endl;
  }
}
template <class X>
void printVecPair(vector<X> &v) {
  for (long long i = (0); i < ((int)v.size()); ++i) {
    cout << v[i].first << " " << v[i].second << endl;
  }
  cout << endl;
}
long long factor2(long long num) {
  int cnt = 0;
  while (num % 2 == 0) {
    num /= 2;
    cnt++;
  }
  return cnt;
}
long long combination(int n, int r) {
  long long up = 1, down = 1;
  long long half = n / 2;
  if (r >= half) r = n - r;
  long long up_tmp = n, down_tmp = r;
  if (r == 0) return 1;
  for (long long i = (0); i < (r); ++i) {
    up *= up_tmp;
    up_tmp--;
    down *= down_tmp;
    down_tmp--;
  }
  return up / down;
}
int factorial(int n, int r) {
  if (n < r) {
    cout << "error" << endl;
    return 0;
  } else {
    int res = 1;
    while (r) {
      r--;
      res *= n;
      n--;
    }
    return res;
  }
}
int find_digits(int n) {
  int digit = 0;
  while (n) {
    n /= 10;
    digit++;
  }
  return digit;
}
int findSumOfDigits(int n) {
  int sum = 0;
  while (n > 0) {
    sum += n % 10;
    n /= 10;
  }
  return sum;
}
int degree(int n) {
  int count = 0;
  while (1) {
    if (count <= 0) break;
    count /= 2;
    count++;
  }
  return count;
}
int shishagonyu(double x) { return (int)(x < 0.0 ? x - 0.5 : x + 0.5); }
int roundUp(double n) {
  if (n >= 0) {
    return (int)n + 1;
  } else {
    return (int)n - 1;
  }
}
int roundDown(double n) { return (int)n; }
int roundOff(double n) {
  double decimal = 0;
  decimal = n - (int)n;
  if (decimal >= 0.5 || decimal <= -0.5) {
    return roundUp(n);
  } else {
    return roundDown(n);
  }
}
int gcd(int m, int n) {
  if (m == 0 || n == 0) return 0;
  while (m != n) {
    if (m > n)
      m = m - n;
    else
      n = n - m;
  }
  return m;
}
long long lcm(long long m, long long n) {
  if (m == 0 || n == 0) return 0;
  return ((m / gcd(m, n)) * n);
}
void prime_factorization(long long n) {
  int a = 2, res;
  bool flg = false;
  if (n < 2) {
    cout << "Error" << endl;
    return;
  }
  while (n >= a * a) {
    if (n % a == 0) {
      res = a;
      if (flg) {
        prime_factor[prime_factor.size() - 1].second++;
      } else {
        prime_factor.push_back(make_pair(0, 1));
        prime_factor[prime_factor.size() - 1].first = res;
      }
      n /= a;
      flg = true;
    } else {
      a++;
      flg = false;
    }
  }
  res = n;
  if (prime_factor[prime_factor.size() - 1].first == res) {
    prime_factor[prime_factor.size() - 1].second++;
  } else {
    prime_factor.push_back(make_pair(res, 1));
  }
}
int Eratosthenes(int n) {
  bool prime[n + 1];
  for (long long i = (2); i < (n); ++i) prime[i] = true;
  for (int i = 2; i < sqrt(n); i++) {
    if (prime[i]) {
      for (int j = 0; i * (j + 2) < n; j++) {
        prime[i * (j + 2)] = false;
      }
    }
  }
  int cnt = 0;
  for (int i = 2; i < n; i++) {
    if (prime[i]) {
      cnt++;
    }
  }
  return cnt;
}
bool odd_even(int num) {
  bool judge;
  if (num % 2) {
    judge = true;
  } else {
    judge = false;
  }
  return judge;
}
long long modinv(long long a, long long m) {
  long long b = m, u = 1, v = 0;
  while (b) {
    long long t = a / b;
    a -= t * b;
    swap(a, b);
    u -= t * v;
    swap(u, v);
  }
  u %= m;
  if (u < 0) u += m;
  return u;
}
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;
}
void COMinit() {
  fac[0] = fac[1] = 1;
  finv[0] = finv[1] = 1;
  inv[1] = 1;
  for (int i = 2; i < TABLEMAX; 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(int n, int 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 abs_ll(long long a) {
  if (a >= 0) {
    return a;
  } else {
    return -a;
  }
}
long long div_one(long long res, long long div) {
  return (res + div - 1) / div;
}
template <class X>
void StringtoVec(string str, vector<X> &v) {
  long long num = stoll(str);
  long long it = str.size() - 1;
  v.resize(str.size());
  while (num) {
    v[it] = num % 10;
    num /= 10;
    it--;
    if (it < 0) {
      cout << "reference error" << endl;
      break;
    }
  }
}
void get_factor_list(long long n) {
  int a = 1, res;
  while (n >= a * a) {
    if (n % a == 0) {
      res = a;
      long long tmp = n / res;
      factor_list.push_back(res);
      factor_list.push_back(tmp);
      a++;
    } else {
      a++;
    }
  }
  sort(factor_list.begin(), factor_list.end());
}
