#include <bits/stdc++.h>
using namespace std;
using pint = pair<int, int>;
long long mod = 1000000007;
int dx[8] = {1, 0, -1, 0, 1, 1, -1, -1};
int dy[8] = {0, 1, 0, -1, 1, -1, 1, -1};
void chmin(long long &a, long long b) {
  if (a > b) a = b;
}
const long long INF = 1LL << 60;
long long gcd(long long a, long long b) {
  if (b == 0)
    return a;
  else
    return gcd(b, a % b);
}
long long lcm(long long a, long long b) {
  long long g = gcd(a, b);
  return (a / g * b);
}
int main() {
  int n, ans = 0;
  cin >> n;
  string p;
  for (int i = 0; i < n; ++i) {
    cin >> p[i];
  }
  for (int i = 0; i < n; ++i) {
    int tmp = p[i] - '0';
    if (tmp == i + 1 && i != n - 1)
      swap(p[i], p[i + 1]), ans++;
    else if (tmp == i + 1 && i == n - 1)
      ans++;
  }
  cout << ans << endl;
  return 0;
}
