#!/usr/bin/env pypy3
import sys
input = sys.stdin.readline

def main():
    N = int(input())
    p = [0] + list(map(int, input().split()))
    ans = 0
    for i in range(1,N+1):
        if p[i] == i:
            ans += 1
            if i != 1 and p[i] != i-1:
                p[i], p[i-1] = p[i-1], p[i]
            else:
                p[i], p[i+1] = p[i+1], p[i]
    print(ans)

if __name__ == '__main__':
    main()