#t109. 完全平方数
完全平方数
Perfect Squares
Problem Description
Xiaoyang has a sequence of non-negative integers. He wants to know how many index pairs with satisfy that is a perfect square.
( is a perfect square if there exists a non-negative integer such that .)
This problem has a corresponding multiple-choice / true-or-false question; see https://ti.luogu.com.cn/problemset/1143.
Input Format
The first line is a non-negative integer , the number of non-negative integers.
The second line contains non-negative integers , the elements of sequence .
Output Format
Output one line containing one integer: the answer.
Sample Input
5
1 4 3 3 5
Sample Output
3
Sample Explanation
For the sample, the sequence is , with numbers in total. The index pairs for which is a perfect square are:
- : , a perfect square.
- : , also a perfect square (note that the sequence contains two 's at different positions).
- : , a perfect square.
None of the other pairs sum to a perfect square, so the answer is .
Constraints
For all test data, and .