def solve():
  n = int(input())
  p = list(map(int, input()))
  cnt = 0
  for i in range(n-1):
    if p[i] == i + 1:
      if p[i] == n:
        p[i], p[i-1] = p[i-1], p[i]
      else:
        p[i], p[i+1] = p[i], p[i+1]
      cnt += 1
  print(cnt)
  return 0
 
if __name__ == "__main__":
  solve()