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