f | s = input() | f | s = input() |
| if not s: | | if not s: |
| print(0) | | print(0) |
| exit() | | exit() |
| seq = set(eval(s)) | | seq = set(eval(s)) |
| M = max(seq) | | M = max(seq) |
| sums_of_squares = set() | | sums_of_squares = set() |
| for i in range(1, int(M ** 0.5) + 1): | | for i in range(1, int(M ** 0.5) + 1): |
| i2 = i * i | | i2 = i * i |
| for j in range(i, int((M - i2) ** 0.5) + 1): | | for j in range(i, int((M - i2) ** 0.5) + 1): |
| j2 = j * j | | j2 = j * j |
| for k in range(j, int((M - i2 - j2) ** 0.5) + 1): | | for k in range(j, int((M - i2 - j2) ** 0.5) + 1): |
| k2 = k * k | | k2 = k * k |
| sum_of_squares = i2 + j2 + k2 | | sum_of_squares = i2 + j2 + k2 |
| if sum_of_squares <= M: | | if sum_of_squares <= M: |
| sums_of_squares.add(sum_of_squares) | | sums_of_squares.add(sum_of_squares) |
t | print(len(sums_of_squares & seq)) | t | print(len(sums_of_squares.intersection(seq))) |