n=int(input()) h=list(map(float,input().split())) s=0 for i in range(1,len(h)-1): if h[i]<h[i-1] and h[i]<=h[i+1]: s=s+1 print(s)