n | from math import * | n | from math import sqrt |
| M0 = set(eval(input())) | | seq = set(eval(input())) |
| M = max(M0) | | M = max(seq) |
| M5 = set() | | squares_sums = set() |
| for i in range(1, int(sqrt(M))): | | 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): |
t | M5.add(k * k + i * i + j * j) | t | squares_sums.add(i * i + j * j + k * k) |
| print(len(M0 & M5)) | | print(len(squares_sums & seq)) |