#d1403. 平方计数

平方计数

Square Counting

Problem Description

Given NN positive integers, with the ii-th denoted by aia_i, count how many pairs (i,j)(i, j) satisfy that ai2+aja_i^2 + a_j is a perfect square.

Input Format

The first line contains a positive integer nn.

The second line contains nn numbers, representing a1,a2,a3,…,ana_1, a_2, a_3, \dots, a_n.

Output Format

One integer on a single line: the answer.

Sample Input

5
1 2 3 4 5

Sample Output

2

Constraints

For all test data, 1≤n≤1061 \le n \le 10^6 and 1≤ai≤1061 \le a_i \le 10^6.