f | from math import sqrt | f | from math import sqrt |
| seq = set(eval(input())) | | seq = set(eval(input())) |
t | m = max(seq) | t | maximum = max(seq) |
| sqrs = set() | | sums = set() |
| for i in range(1, int(sqrt(m)) + 1): | | for i in range(1, int(sqrt(maximum)) + 1): |
| i2 = i * i | | ii = i * i |
| for j in range(i, int(sqrt(m - i2)) + 1): | | for j in range(i, int(sqrt(maximum - ii)) + 1): |
| j2 = j * j | | jj = j * j |
| for k in range(j, int(sqrt(m - i2 - j2)) + 1): | | for k in range(j, int(sqrt(maximum - ii - jj)) + 1): |
| sqrs.add(i2 + j2 + k * k) | | sums.add(ii + jj + k * k) |
| print(len(sqrs.intersection(seq))) | | print(len(seq & sums)) |