package main import . "fmt" func main() { var n,c int Scan(&n) x:=make([]int,n) for i:=range x { Scan(&x[i]) if i>1&&isKadomatsu(x[i-2:]) { c++ } } Println(c) } func isKadomatsu(x []int)bool { if len(x)<3 { return false } return x[0]!=x[2]&& ((x[1]>x[0]&&x[1]>x[2])|| (x[1]