from sys import stdin
di = {}
n = int(stdin.readline())
a = [0] + map(int,stdin.readline().split())
ans = 0
for i in xrange(1,n):
    if a[i]==i:
        x = a[i]
        a[i] = a[i+1]
        a[i+1] = x
        ans+=1
if a[n]==n:
    ans+=1
print ans