Олимпиадный тренинг

Задача 34918. Number of local maxima


Задача

Темы: Цикл while

An element of a sequence is called a local maximum if it is strictly greater than the previous and subsequent elements of the sequence. The first and last element of the sequence are not local maxima.

Given a sequence of natural numbers, the sign of the end of which is the number 0 (0 is not included in the sequence). Determine the number of strict local maxima in this sequence. 

Numbers after 0 do not need to be read.

Input: Given a sequence of natural numbers, the sign of the end of which is the number 0.
Output: Output the answer to the problem.

Examples
# Input Output
1 1
2
1
2
1
0
2