import sys
from collections import deque, Counter, defaultdict
from fractions import gcd
input = sys.stdin.readline

def eprint(s):
    if type(s) != type('str'):
        s=str(s)

    sys.stderr.write(s+'\n')
    return

def check(h):
    n = len(h)
    cps = [False]*n
    for i in range(n):
        if h[i] != i+1:
            cps[i] = True
    return cps
        

def main():
    n = int(input())
    Ps = list(map(int, input().split()))
    cnt = int()
    #となりあうFalseは絶対にTrueになる
    cps = check(Ps)
    for i in range(n-1):
        if not cps[i]:
            Ps[i], Ps[i+1] = Ps[i+1], Ps[i]
            cps[i], cps[i+1] = True, True
            cnt += 1
    cps = check(Ps)
    eprint(cps)
    print(cnt)
    return

if __name__ == '__main__':
    main()
