output_description: Print the number of elements p_i (1 < i < n) that satisfy the condition.
  
  * * *
input_description: Input is given from Standard Input in the following format:
  
      
      
      n
      p_1 p_2 ... p_n
attempt: def second_smallest(numbers):
      m1, m2 = float("inf"), float("inf")
      for x in numbers:
          if x <= m1:
              m1, m2 = x, m1
          elif x < m2:
              m2 = x
      return m2
  
  
  n = int(input())
  numbers = input()
  
  numbers = [int(x) for x in numbers.split()]
  
  print(numbers)
  smallest = set()
  for i in range(len(numbers)):
      if (i + 2) >= len(numbers):
          break
  
      min_number = second_smallest([numbers[i], numbers[i + 1], numbers[i + 2]])
      if not (min_number in smallest):
          smallest.add(min_number)
  
  print(len(smallest))
  
problem_description: Statement
  
  We have a permutation p = {p_1,\ p_2,\ ...,\ p_n} of {1,\ 2,\ ...,\ n}.
  
  Print the number of elements p_i (1 < i < n) that satisfy the following
  condition:
  
    * p_i is the second smallest number among the three numbers p_{i - 1}, p_i, and p_{i + 1}.
samples: [{"input": "5\n    1 3 5 4 2", "output": "2\n    \n\np_2 = 3 is the second smallest number among p_1 = 1, p_2 = 3, and p_3 = 5.\nAlso, p_4 = 4 is the second smallest number among p_3 = 5, p_4 = 4, and p_5 =\n2. These two elements satisfy the condition.\n\n* * *"}, {"input": "9\n    9 6 3 2 5 8 7 4 1", "output": "5"}]