f | from math import sqrt | f | from math import sqrt |
| seq = set(eval(input())) | | seq = set(eval(input())) |
t | m = max(seq) | t | M = max(seq) |
| squares = set() | | numbers = set() |
| for i in range(1, int(sqrt(m)) + 1): | | for i in range(1, int(sqrt(M)) + 1): |
| for j in range(i, int(sqrt(m - i * i)) + 1): | | for j in range(i, int(sqrt(M - i * i)) + 1): |
| for k in range(j, int(sqrt(m - i * i - j * j)) + 1): | | for k in range(j, int(sqrt(M - i * i - j * j)) + 1): |
| squares.add(i * i + j * j + k * k) | | numbers.add(i * i + j * j + k * k) |
| res = seq & squares | | res = seq.intersection(numbers) |
| print(len(res)) | | print(len(res)) |