The sum of the elements of a pair is a multiple of 8
Problem
The input of the program is a sequence of
N
positive integers, all numbers in the sequence are different. All pairs of different elements of the sequence are considered, located at a distance of at least 4 (the difference in the indices of the elements of the pair must be 4 or more, the order of the elements in the pair is unimportant). It is necessary to determine the number of such pairs for which the sum of the elements is a multiple of 8.
Input
The first line of the input specifies the number of numbers
N
(
\(5 <= N <= 1000\)). Each of the following
N
lines contains one positive integer not exceeding 10,000.
Imprint
As a result, the program should print one number: the number of pairs of elements that are in the sequence at least 4 apart, in which the sum of the elements is a multiple of 8.
Examples
# |
Input |
Output |
Comment |
1 |
7
1
5
9
8
15
23
31 |
4 |
Found pairs: (1.15) (1.23) (1.31) (9.31) |