
url = "https://atcoder.jp//contests/abc072/tasks/arc082_b"

def main():
    n = input()
    p = list(map(int, input().split()))
    count = 0
    for i, v in enumerate(p):
        if i == len(p)-1:
            print(count)
            exit()
        if i+1 == v or i+2 == p[i+1]:
            p[i] = p[i+1]
            p[i+1] = v
            count += 1




if __name__ == '__main__':
    main()
