#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, m;
  cin >> N;
  m = N;
  vector<int> a;
  int Max = 0;
  while (N--) {
    int x;
    scanf("%d", &x);
    a.push_back(x);
  }
  sort(a.begin(), a.end());
  for (int i = 0; i < m - 1; i++) {
    if (a[i] == i + 1 && a[i + 1] == i + 2) {
      swap(a[i], a[i + 1]);
      Max++;
    }
  }
  for (int i = 0; i < m; i++) {
    if (a[i] == 1) {
      Max++;
    }
  }
  cout << Max << endl;
  return 0;
}
