N = int(input())
p = [int(i) for i in input().split()]
def_p = []
for i in range(N):
    def_p += ["0"] if i + 1 == p[i] else ["1"]
str_p = "".join(def_p).split("1")
ans = 0
for i in str_p:
    if i == "":
        continue
    elif i == "0":
        ans += 1
    else:
        ans += len(i) - 1
print(ans)
