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()))

ans = 0
for i in range(N - 1):
    if i == P[i]:
        P[i], P[i + 1] = P[i + 1], P[i] 
        ans += 1
print(ans)
import sys


def input():
    return sys.stdin.readline().strip()


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

ans = 0
for i in range(N - 1):
    if i + 1 == P[i]:
        P[i], P[i + 1] = P[i + 1], P[i] 
        ans += 1
if P[N-1] == N:
    ans += 1
print(ans)
