import numpy as np
N = int(input())
p = np.array(list(map(int, input().split())))
v = p == np.arange(1, N + 1)
print('v', v)
ans = 0
for i in range(N):
    if i == N - 1 and v[i]:
        ans += 1
        continue
    if v[i]:
        v[i], v[i + 1] = False, False
        ans += 1
print(ans)
