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