import sys
input = sys.stdin.readline

def main():
    N = int(input())
    p = list(map(int, input().split()))

    ans = 0
    i = 0
    while i < N:
        if i+1 == p[i]:
            tmp = p[i]
            p[i] = p[i+1]
            p[i+1] = tmp
            ans += 1
            i += 1
        i += 1
    print(ans)

if __name__ == "__main__":
    main()