#include <bits/stdc++.h>
using namespace std;
int main() {
  int a[100000], n, i, count = 0;
  cin >> n;
  for (i = 1; i <= n; i++) {
    cin >> a[i];
    if (a[i] == i) count++;
  }
  cout << count;
}
