from sys import stdin

n = int(stdin.readline().rstrip())

li = list(map(int,stdin.readline().rstrip().split()))

mi = 10**10

for i in range(100):

    point = 0

    for j in li:

        point += (j-i)**2

    mi = min(mi,point)

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

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



min_power = 10**10



#どこの座標で集会をするか

for i in range(1,101):

    power = 0

    for j in X:

        power += (j-i)**2

    min_power = min(min_power,power)



print(min_power)
from sys import stdin

n = int(stdin.readline().rstrip())
li = list(map(int, stdin.readline().rstrip().split()))
mi = 10**10
for i in range(100):
    point = 0
    for j in li:
        point += (j - i) ** 2
    mi = min(mi, point)
print(mi)

N = int(eval(input()))
X = list(map(int, input().split()))
min_power = 10**10
# どこの座標で集会をするか
for i in range(1, 101):
    power = 0
    for j in X:
        power += (j - i) ** 2
    min_power = min(min_power, power)
print(min_power)

-from sys import stdin - -n = int(stdin.readline().rstrip()) -li = list(map(int, stdin.readline().rstrip().split())) -mi = 10**10 -for i in range(100): -    point = 0 -    for j in li: -        point += (j - i) ** 2 -    mi = min(mi, point) -print(mi) +N = int(eval(input())) +X = list(map(int, input().split())) +min_power = 10**10 +# どこの座標で集会をするか +for i in range(1, 101): +    power = 0 +    for j in X: +        power += (j - i) ** 2 +    min_power = min(min_power, power) +print(min_power)