def main():
    _ = int(input())
    p_list = [int(p) for p in input().split()]

    cnt = 0
    for i in range(len(p_list)-1):
        if i+1 == p_list[i]:
            cnt += 1
            p_list[i], p_list[i+1] = p_list[i+1], p_list[i]
        if i+2 == p_list[i+1]:
            cnt += 1
            p_list[i], p_list[i+1] = p_list[i+1], p_list[i]
    print(cnt)


if __name__ == "__main__":
    main()