Problem

18 /23


Pair processing

Problem

The input of the program is a sequence of N positive integers. There are no repeating numbers in the sequence. 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 unimportant). It is necessary to find the number of pairs whose product of elements is a multiple of 3 and between the elements of the pair is the maximum element of the sequence.

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 output a single number, the number of pairs found.
 

 

Examples
# Input Output Comment
1






7
5 Found pairs: (1.6) (2.6) (3.5) (3.6) (3.7)