In CS2 there's a warmup, so why not make one here too?
Given an array of size . Find the number of pairs i,j(1 \le i < j \le n) such that (a_i+a_j)^2 = a_i + a_j.
The first line contains one integer (1 \leq n \leq 2 \cdot 10^5) — the size of array .
The second line contains integers a_i (-n \leq a_i \leq n) representing the elements of the array .
Output the number of pairs i,j(1 \le i < j \le n) such that (a_i+a_j)^2 = a_i + a_j.
Example 1
Example 2
( points): a_i = 0
( points): 0 \le a_i \le 1;
( points): -1 \le a_i \le 1;
( points): n \le 100;
( points): no additional constraints