Square number - MarisaOJ: Marisa Online Judge

Square number

Time limit: 1000 ms
Memory limit: 256 MB
Given an array $A$ of $n$ integers. Count the number of pairs $i < j$ that $A_i \times A_j$ is a square number. ### Input - The first line contains an integer $n$. - The second line contains $n$ integers $A_i$. ### Output - Print the number of pairs $i < j$ that $A_i \times A_j$ is a square number. ### Constraints - $1 \le n \le 3 \times 10^5$. - $1 \le A_i \le 10^6$. ### Example Input: ``` 4 1 2 4 8 ``` Output: ``` 2 ```