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

Задача 38935. Triplets of numbers - 1


Задача

Темы: Цикл 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 for which the sum of the first two numbers from the given triple is equal to the third number in 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
3
5
8
3
 
 
Запрещенные операторы:[