
import sys
input = sys.stdin.readline
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
# A = [ int(input()) for _ in range(N) ]
##############################

N = int(input())
P = list(map(int,input().split()))

count = 0
for i in range(N):
    if P[i] == i+1:
        x = P[i]
        P[i] = P[i+1]
        P[i+1] = x
        count += 1

print(count)