N = int(input())
p = list(map(int, input().split()))
count = 0
for i in range(N):
    if p[i] == i + 1:
        count += 1
if count == 0:
    print(0)
elif count == 1:
    print(1)
else:
    print(count - 1)
