

N = int(eval(input()))

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

maxValue = max(x_list)

minValue = 1000000

for i in range(1,100):

    ans = 0

    for j in range(N):

        ans += ( x_list[j] - i ) **2



    if(ans < minValue):

        minValue = ans



print(minValue)


N = int(eval(input()))



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



p = round( sum(x_list) / N )

ans = 0



for i in range(N):

    # ans += round( (x_list[i] - p) ** 2 )

    ans +=  (x_list[i] - p) ** 2 



print(ans)





N = int(eval(input()))
x_list = list(map(int, input().split()))
maxValue = max(x_list)
minValue = 1000000
for i in range(1, 100):
    ans = 0
    for j in range(N):
        ans += (x_list[j] - i) ** 2
    if ans < minValue:
        minValue = ans
print(minValue)

N = int(eval(input()))
x_list = list(map(int, input().split()))
p = round(sum(x_list) / N)
ans = 0
for i in range(N):
    # ans += round( (x_list[i] - p) ** 2 )
    ans += (x_list[i] - p) ** 2
print(ans)

-maxValue = max(x_list) -minValue = 1000000 -for i in range(1, 100): -    ans = 0 -    for j in range(N): -        ans += (x_list[j] - i) ** 2 -    if ans < minValue: -        minValue = ans -print(minValue) +p = round(sum(x_list) / N) +ans = 0 +for i in range(N): +    # ans += round( (x_list[i] - p) ** 2 ) +    ans += (x_list[i] - p) ** 2 +print(ans)