import sys

def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))  #空白あり

N = I()
p = [0] + LI()

# 左から貪欲に

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

print(ans)