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

Задача 38934. Pairs of numbers with a sum divisible by 3


Задача

Темы: Цикл for
Given a natural number N - the number of numbers that are input. A pair is any 2 numbers that are entered  successively one after another. Determine the number of pairs of numbers whose sum is a multiple of 3.

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
4
2
6
5
4
2

Запрещенные операторы:[