import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
 
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
 
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N = INT()
A = LIST()
B = [i for i in range(1, N + 1)]
C = [0] * N

for i in range(N):
    if A[i] == B[i]:
        C[i] = 1

# for i in range(N-1):
r = 0
ans = 0
pre_is_one = False
while r < N:
    if C[r] == 1:
        ans += 1
        r += 1
        if pre_is_one == True:
            ans -= 1
        pre_is_one = True
    else:
        r += 1
        pre_is_one = False
    
print(ans)
        


    