n = input()
swap = 0
flag = False
buff = -1
ai = list(int(i) for i in input().split())
for i in range(len(ai)-1):
    if i+1 == ai[i]:
        if not(flag):
            tmp = ai[i]
            ai[i] = ai[i+1]
            ai[i+1] = tmp
            flag = True
            buff = i
            swap = swap + 1
        if flag:
            tmp = ai[i]
            ai[i] = ai[i-1]
            ai[i-1] = tmp
            ai[i-1] = ai[i-2]
            ai[i-2] = tmp
            flag = False
    else:
        flag = False
        buff = -1
print(swap)
