N, *X = map(int, open(0).read().split())
ans = float("inf")
for x in range(min(X), max(X) + 1):
    cur = 0
    for j in range(N):
        cur += (X[j] - x) ** 2
    ans = min(ans, cur)
print(ans) N, *X = map(int, open(0).read().split()) N map(int, open(0).read().split()) map int open(0).read().split() (0).read().split (0).read() (0).read (0) open 0 read split *X X ans = float("inf") ans float("inf") float "inf" for x in range(min(X), max(X) + 1):
    cur = 0
    for j in range(N):
        cur += (X[j] - x) ** 2
    ans = min(ans, cur) x range(min(X), max(X) + 1) range min(X) min X max(X) + 1 max(X) max X 1 cur = 0 cur 0 for j in range(N):
        cur += (X[j] - x) ** 2
     j range(N) range N cur += (X[j] - x) ** 2 cur (X[j] - x) ** 2 X[j] - x X[j] X j x 2 ans = min(ans, cur) ans min(ans, cur) min ans cur print(ans) print ans N, *X = map(int, open(0).read().split()) map(int, open(0).read().split()) N ans = float("inf") float("inf") ans cur = 0 0 cur cur += (X[j] - x) ** 2 (X[j] - x) ** 2 cur ans = min(ans, cur) min(ans, cur) ans
N, *X = map(int, open(0).read().split())
ans = float("inf")
for x in range(min(X), max(X) + 1):
    cur = 0
    for j in range(N):
        cur += (X[j] - x) ** 2
    ans = min(ans, cur)
print(ans)
