import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int N = sc.nextInt(); int [] A = new int [N]; int c = 0; for(int i=0; i=2){ if( A[i-1] > A[i] && A[i-1] > A[i-2] && A[i] != A[i-2] ){ c++; }else if(A[i-1] < A[i] && A[i-1] < A[i-2] && A[i] != A[i-2] ){ c++; } } } System.out.println(c); } }