import bisect
from collections import Counter, deque
from fractions import gcd
from functools import lru_cache
from functools import reduce
import functools
import heapq
import itertools
import math
import numpy as np
import re
import sys

sys.setrecursionlimit(10000)
INF = float('inf')

N = int(sys.stdin.readline())
P = list(map(int, sys.stdin.readline().split()))
P.insert(0, -1)

ans = 0
for i in range(len(P)):
    if i == P[i]:
        if i + 1 < len(P):
            P[i], P[i + 1] = P[i + 1], P[i]
        ans += 1
print(ans)
