N = int(input())
P_s = list(map(int, input().split()))

orders = [i + 1 for i in range(N)]
total = 0

if (P_s[0] == 1):
    tmp = P_s[0]
    P_s[0] = P_s[1]
    P_s[1] = tmp
    total += 1

for i in range(1, N):
    p = P_s[i]
    n = orders[i]
    
    if (n == p):
        tmp = P_s[i]
        P_s[i] = P_s[i - 1]
        P_s[i - 1] = tmp
        total += 1

print(total)
