#include <bits/stdc++.h>
using namespace std;
template <class T>
istream& operator>>(istream& s, vector<T>& v) {
  for (T& x : v) {
    s >> x;
  }
  return s;
}
void yes() { cout << "Yes" << endl; }
void no() { cout << "No" << endl; }
int SIZE(string s) { return (int)s.size(); }
int main() {
  cout << setprecision(16);
  int n;
  cin >> n;
  int ans = 0;
  for (int i = 0; i < (n); ++i) {
    int x;
    cin >> x;
    if (x == i + 1) ans++;
  }
  cout << ans << endl;
  return 0;
}
