import sys
import random


test =False
debug = False
loop = False

def main(N, items):
    counter = 0
    i = 0
    if test:
        print N, items
    if debug:
        print items
    while i < N - 1:
        if i + 1 == items[i]:
            tmp = items[i+1]
            items[i+1] = items[i]
            items[i] = tmp
            counter += 1
            if debug:
                print items
        i += 1
    assert i == N - 1
    if items[i] == N:
        tmp = items[i]
        items[i] = items[i-1]
        items[i-1] = tmp
        counter += 1
        if debug:
            print items
    print counter

if __name__ == "__main__":
    if test:
        if loop:
            while True:
                N = random.randint(2, 10)
                items = range(1, N + 1)
                assert len(items) == N
                random.shuffle(items)
                main(N, items)
        else:
            N = 4
            items = [3,2,1,4]
            main(N, items)
    else:
        N = int(raw_input())
        items = raw_input().split()
        items = [int(item) for item in items]
        main(N, items)
