Alice found cards. There is a number written on each card. While she was waiting for her friends to play some game, she decided to count the number of ways she can choose cards, such that the geometric of the numbers on the selected cards is an integer.
Can you help her to count the number of quadruples when the geometric mean is integer?
Formally, given an array of length , we want to count the quadruples such that is an integer.
Input data
The input file consists of:
- a line containing integer : the number of the cards.
- a line containing the integers : the numbers written on the cards.
Output data
The output file must contain a single line consisting of a -bit integer: the number of quadruples of cards with integer geometric mean.
Constraints and clarifications
- .
- for each .
Your program will be tested against several test cases grouped in subtasks. In order to obtain the score of a subtask, your program needs to correctly solve all of its test cases.
# | Points | Constraints |
---|---|---|
1 | 0 | Examples |
2 | 10 | , and for each |
3 | 10 | |
4 | 10 | is a power of two for each |
5 | 25 | |
6 | 45 | No additional limitations |
The geometric mean of is .
Example 1
stdin
8
1 6 4 5 7 10 15 14
stdout
0
Explanation
In the first sample case we can not choose numbers, such that their geometric mean is integer.
Example 2
stdin
7
2024 2024 2024 2024 2024 2024 2024
stdout
35
Explanation
In the second sample case any four-tuple is good, so the answer is
Example 3
stdin
8
1 2 4 8 16 32 64 128
stdout
18
Explanation
In the third sample case we have good quadruples: , , , , , , , , , , , , , , , , .
For example, is good, because .