n = int(input())
p = list(map(int, input().split()))
st = []
c = 0
for i in range(0,n):
    if (p[i] == i+1):
        st.append(1)
    else:
        st.append(0)
print(st)
def cal(a):   
    global c    
    if (st[a]== 1 and  st[a+1]==1):
        c += 1
        return a+2
    return a+1
p=0           
while (p < n-1):
    p = cal(p)
    
y = st.count(1)
print(y-c)
        