#include <bits/stdc++.h>
using namespace std;
const int M = 1e9 + 7;
const double eps = 1e-10;
const double pi = acos(-1.0);
const int inf = 0x3f3f3f3f;
const long long linf = 1e18;
const int N = 1e6 + 10;
int n;
int main() {
  cin >> n;
  int ans = 0, x;
  for (int i = 0; i < n; i++) {
    scanf("%d", &x);
    ans += ((x - 1) == i);
  }
  cout << ans << endl;
  return 0;
}
