f | from math import sqrt | f | from math import sqrt |
| seq = set(eval(input())) | | seq = set(eval(input())) |
t | max_elem = max(seq) | t | M = max(seq) |
| three_squares_sum = set() | | summ = set() |
| for i in range(1, int(sqrt(max_elem)) + 1): | | for i in range(1, int(sqrt(M)) + 1): |
| for j in range(i, int(sqrt(max_elem - i * i)) + 1): | | for j in range(i, int(sqrt(M - i * i)) + 1): |
| for k in range(j, int(sqrt(max_elem - i * i - j * j)) + 1): | | for z in range(j, int(sqrt(M - i * i - j * j)) + 1): |
| three_squares_sum.add(i * i + j * j + k * k) | | summ.add(i * i + j * j + z * z) |
| print(len(seq & three_squares_sum)) | | print(len(summ & seq)) |