Problem

9 /23


The sum is a multiple of three, the product is a multiple of five

Problem

The input of the program is a sequence of N positive integers. All pairs of different elements of the sequence are considered (the elements of a pair do not have to be side by side in the sequence, the order of the elements in the pair is not important). 
It is necessary to determine the number of pairs, the sum of which is a multiple of 3, and the product is a multiple of 5. The number N and then the N numbers themselves are input to the algorithm.

Input
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 10000.

Imprint
As a result, the program should display one number: the number of pairs found.
 

 

Examples
# Input Output
1 10
1
2
3
4
5
6
7
8
9
10
6
Found pairs for example: {(1;5) (2;10) (4;5) (5;7) (5;10) (8;10)}