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