CodeLab Academy 📞 9936 6696
← List Python · Level 7: Lists Code · 70 points ← #641 #643 →

#642. Local peaks

How many inner elements (not the first or the last) are strictly greater than both of their neighbors? ### Input The first line has n, the second line has n integers separated by spaces. ### Output A number.

Examples

Input
15
15 3 9 1 12 2 2 12 1 7 5 20 4 16 13
Output
6
Input
9
13 18 3 9 20 6 16 10 7
Output
3

💡 You can solve it with Python, JavaScript or blocks. Read the input line by line with input(). Don't print a question (like input("Number: ")). Print exactly what the output asks for, nothing more.

🔒 You can solve the first 3 problems without an account. Sign up for free to solve this one!