#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, count = 0, a;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a);
    if (a == i) count++;
  }
  printf("%d\n", count);
}
