N, *X = list(map(int, open(0).read().split()))



m = sum(X) // N

v1 = sum((v - m) ** 2 for v in X)

v2 = sum((v - m - 1) ** 2 for v in X)

print((min(v1, v2)))



N = int(eval(input()))

X = list(map(int, input().split()))



cand = sum(X) // N

ans0 = sum((v - cand) ** 2 for v in X)

ans1 = sum((v - cand - 1) ** 2 for v in X)

print((min(ans0, ans1)))

N, *X = list(map(int, open(0).read().split()))
m = sum(X) // N
v1 = sum((v - m) ** 2 for v in X)
v2 = sum((v - m - 1) ** 2 for v in X)
print((min(v1, v2)))

N = int(eval(input()))
X = list(map(int, input().split()))
cand = sum(X) // N
ans0 = sum((v - cand) ** 2 for v in X)
ans1 = sum((v - cand - 1) ** 2 for v in X)
print((min(ans0, ans1)))

-N, *X = list(map(int, open(0).read().split())) -m = sum(X) // N -v1 = sum((v - m) ** 2 for v in X) -v2 = sum((v - m - 1) ** 2 for v in X) -print((min(v1, v2))) +N = int(eval(input())) +X = list(map(int, input().split())) +cand = sum(X) // N +ans0 = sum((v - cand) ** 2 for v in X) +ans1 = sum((v - cand - 1) ** 2 for v in X) +print((min(ans0, ans1)))