N=int(eval(input()))

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

ans=float('inf')

p=0

for i in range(1,100):

    for k in range(N):

        p+=((X[k]-i)**2)

    ans=min(ans,p)

    p=0

print(ans)
N=int(eval(input()))

X=list(map(int,input().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 = float("inf")
p = 0
for i in range(1, 100):
    for k in range(N):
        p += (X[k] - i) ** 2
    ans = min(ans, p)
    p = 0
print(ans)

N = int(eval(input()))
X = list(map(int, input().split()))
P = round(sum(X) / N)
print((sum((x - P) ** 2 for x in X)))

-ans = float("inf") -p = 0 -for i in range(1, 100): -    for k in range(N): -        p += (X[k] - i) ** 2 -    ans = min(ans, p) -    p = 0 -print(ans) +P = round(sum(X) / N) +print((sum((x - P) ** 2 for x in X)))