LearnPy Hub
← Arena
EasyRating 900

Local Peaks

A position is a peak if its value is greater than both neighbours. The first and last positions are never peaks. Count the peaks.

Input

n, then n integers.

Output

One integer.

Sample 1

Input
7
1 3 2 4 1 5 2
Output
3

Sample 2

Input
2
1 2
Output
0
solution.py
Output appears here
Local Peaks · Python Arena problem · LearnPy Hub