Олимпиадный тренинг

Задача 21840. Pythagorean triplets


Задача

Темы:

Fedor has an array of various natural numbers. It is known that numbers N. Fedor wants to find in the array the number of triplets x, y and z (x < y < z) such that x2 + y 2 = z2. Help him with this.

Input data format

The first line contains the number N (3 ≤ N ≤ 3000 ). The next line contains N natural numbers, each of which does not exceed 3000.

Solutions that work correctly with N ≤ 100 will receive at least 50 points.

Output Format

In a single line, you need to print one number — answer to the problem.

Input:

5
5 12 13 9 15

Output:
2