n = int(input())
ps = [int(item) for item in input().split()]

l = 0
change = 0
while l < n:
    if ps[l] == l+1:
        change += 1
        l += 2 
    else:
        l += 1
if ps[-1] == n and ps[-2] != n-1:
    change += 1

print(change)