import java.util.Scanner; // WA 解 public class Yuki116 { public Yuki116() { Scanner scanner = new Scanner(System.in); int N = scanner.nextInt(); int[] A = new int[N]; for (int i = 0; i < N; i++) { A[i] = scanner.nextInt(); } int count = 0; for (int i = 1; i < N - 1; i++) { if (A[i - 1] < A[i] && A[i] > A[i + 1] && A[i - 1] != A[i + 1]) { count++; } } System.out.println(count); } public static void main(String[] args) { Yuki116 hoge = new Yuki116(); } }