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)
def cal(a):
    global c
    for j in range(a,n-1):
        if (st[j] == 1 and  st[j+1]==1):
            c += 1
            cal(j+2)
    return c
           
x = cal(0)
y = st.count(1)
print(y-x)
        