#include <bits/stdc++.h>
using namespace std;
const int INF = 1e+9;
const int MOD = 1e+9 + 7;
int main() {
  int N, cnt, p;
  cin >> N;
  cnt = 0;
  for (long long i = 0; i < (long long)(N); i++) {
    cin >> p;
    if (p == i + 1) cnt++;
  }
  cout << cnt << endl;
}
