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

Задача 38936. Triplets of numbers - 2


Задача

Темы: Цикл for
Given a natural number N - the number of numbers that are input. A triple is any 3 numbers that are entered  successively one after another. Determine the number of triples of numbers in which the second number from the triple is greater than the first and third numbers from the given triple.

Input
The first line contains a natural number N (N<105). The following N lines contain numbers, one per line. Each number does not exceed 109.

Imprint
Display one number on the screen - the answer to the problem. 
 
Examples
# Input Output
1 5
1
2
1
9
8
2
 
 
Запрещенные операторы:[