n = input().strip()
n= int(n)
arr = list(map(int, input().strip().split(' ')))
arr.append(n+1)
#print(arr[::2])


c = 0
for i in range(0, len(arr), 2):
    if arr[i] == i+1 or arr[i+1] == i+2:
        c += 1
print(c-1)
        