from itertools import takewhile

import numpy as np


def count(arr, index):
    unsame = arr != index
    if not unsame.any():
        return 0
    num_of_consective = []
    num = 0
    for tf in unsame:
        if tf:
            num += 1
        else:
            num_of_consective.append(num)
            num = 0
    num_of_consective.append(num)
    return sum([x // 2 if x % 2 == 0 else x // 2 + 1 for x in num_of_consective])


def main():
    n = int(input())
    index = np.arange(1, n + 1)
    p_list = np.array(list(map(int, input().split(" "))))
    print(count(p_list, index))


if __name__ == "__main__":
    main()
