Math

아직 제출이 없습니다시간 제한2초메모리 제한512 MB

문제

You are given an array aa of nn distinct positive integers. Find the number of pairs (i,j)(i, j) with 1i,jn1 \le i, j \le n for which the number a_i2+a_ja\_i^2 + a\_j is a square of an integer.

입력

The first line of the input contains a single integer nn (1n1061 \le n \le 10^6), the size of the array.

The second line of the input contains nn distinct positive integers a_1,,a_na\_1, \ldots, a\_n (1a_i1061 \le a\_i \le 10^6).

출력

Output a single integer: the answer to the problem.

힌트

In the example, there are two such pairs, corresponding to 12+3=4=221^2 + 3 = 4 = 2^2 and 22+5=9=322^2 + 5 = 9 = 3^2.