n = int(input())
li = list(map(int,input().split()))

def swap(a,b):
    c = li[a]
    li[a] = li[b]
    li[b] = c

ans = 0
for i in range(n-1):
    memo = i+1

    if memo == li[i]:
        swap(i,i+1)
        ans += 1

print(ans)