n = int(eval(input()))

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

ans = 1000000000

for p in range(1,101):

    s = 0

    for x in X:

        s += (x-p)**2

    ans = min(ans, s)

print(ans)
n,*X = list(map(int, open(0).read().split()))

p = round(sum(X)/n)

print((sum((x-p)**2 for x in X)))
n = int(eval(input()))
X = list(map(int, input().split()))
ans = 1000000000
for p in range(1, 101):
    s = 0
    for x in X:
        s += (x - p) ** 2
    ans = min(ans, s)
print(ans)

n, *X = list(map(int, open(0).read().split()))
p = round(sum(X) / n)
print((sum((x - p) ** 2 for x in X)))

-n = int(eval(input())) -X = list(map(int, input().split())) -ans = 1000000000 -for p in range(1, 101): -    s = 0 -    for x in X: -        s += (x - p) ** 2 -    ans = min(ans, s) -print(ans) +n, *X = list(map(int, open(0).read().split())) +p = round(sum(X) / n) +print((sum((x - p) ** 2 for x in X)))