Given a set of N
natural numbers. It is necessary to determine the number of pairs of elements (ai
, aj
) of this set, in which \(1 < i < j < N\) and the sum of the elements is a multiple of 12.
Write a time and memory efficient program to solve this problem.
Input data
The first line of the input specifies the number of numbers N
(\(1 < N <= 10000\)). Each of the following N
lines contains one natural number not exceeding 1000.
Imprint data
Output the answer to the problem
Examples
# |
Input |
Output |
1 |
5
7
5
6
12
24
|
2 |
In the given set of 5 numbers, there are two pairs (7, 5) and (12, 24) whose sum of elements is a multiple of 12.