import numpy as np
N=int(input())
p=list(map(int,input().split()))

a=[]
for i in range(1,N+1):
    a.append(i)
a=np.array(a)

A=a-p
print(A)
B=A[1:]-A[:-1]
print(np.count_nonzero(A==0)-np.count_nonzero((A[1:]-A[:-1])==0)+np.count_nonzero((B[1:]-B[:-1])==0))