#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
int main() {
  int n;
  cin >> n;
  int ans = 0;
  cin >> n;
  vector<int> p(n);
  for (int i = 0; i < (n); i++) cin >> p[i];
  for (int i = 0; i < (n); i++) {
    if (i == p[i] - 1) {
      ans++;
      if (i <= n - 1)
        swap(p[i], p[i + 1]);
      else
        swap(p[i], p[i - 1]);
    }
  }
  cout << ans << endl;
}
