def main():
    n = int(input())
    p = [int(x) - 1 for x in input().split()]
    ans = 0
    for i in range(n):
        if p[i] == i:
            if i < n - 1:
                p[i], p[i + 1] = p[i + 1], p[i]
                ans += 1
            else:
                p[i], p[0] = p[0], p[i]
    print(ans)


main()
# print(*data, sep='\n')
