n=int(input()) a=list(map(int,input().split())) count=0 for i in range(1,n-1): if((a[i]>a[i-1] and a[i]>a[i+1]) or (a[i]<a[i-1] and a[i]<a[i+1])): #既然是折点,那么就是折点附近的两个点大于、小于折点的值 count = count + 1 print(count)
嗷嗷,输入输出终于不报错啦!!!鼓掌鼓掌!!!!