z-zidar
Mr. Little Z has found a job as a construction worker. One day while he was walking around a building site, he noticed his colleagues making right triangles with planks from the building site. Mr. Little Z wanted to help by telling his colleagues the maximum number of different right triangles they can make with the planks. All of the planks from the building site have integer length, and no two planks have the same length.
Help Mr. Little Z calculate how many different right triangles can be made with the planks from the building site.
InputThe first line of the standard input contains one number n, n <= 1000, which represents the number of planks. In the next n lines there is one number representing the length of each plank. The maximum length of a plank is 30000.
OutputTo the standard output write one number that represents the number of different right triangles Mr. Little Z can make with the given planks.
Input:
Output:
Explanation: One triangle can be made with the planks of lengths: 9, 12 and 15, and another one with the planks of lengths 12, 16 and 20.
5
12
16
20
9
15Output:
2Explanation: One triangle can be made with the planks of lengths: 9, 12 and 15, and another one with the planks of lengths 12, 16 and 20.
Submit solution
Coming laterThe grading service will be connected in a later migration step. You can inspect the task and your previous results now.