You are given a permutation p_1,p_2,...,p_N consisting of 1,2,..,N. You can perform the following operation any number of times (possibly zero):  Operation: Swap two **adjacent** elements in the permutation.  You want to have p_i ≠ i for all 1≤i≤N. Find the minimum required number of operations to achieve this.
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)

N = int(input())
p = list(map(int, input().split()))
count = 0

for i in range(N):
    if p[i] == i + 1:
        if i == N - 1:
            temp = p[N - 2]
            p[N - 2] = p[N - 1]
            p[N - 1] = temp
            count += 1
        else:
            temp = p[i + 1]
            p[i + 1] = p[i]
            p[i] = temp
            count += 1

print(count)
