n = int(eval(input()))

x = [int(i) for i in input().split()]

p = 10000000

for i in range(100):

    pi = 0

    for j in range(n):

        pi += (x[j] - (i + 1))**2

    if pi < p:

        p = pi

    # else:

    #     break

        # p[i] += (x[j]-(i+1))**2

print(p)
n = int(eval(input()))

x = [int(i) for i in input().split()]

p = 10000000

for i in range(100):

    pi = 0

    for j in range(n):

        pi += (x[j] - (i + 1))**2

    if pi < p:

        p = pi

    else:

        break

        # p[i] += (x[j]-(i+1))**2

print(p)
n = int(eval(input()))
x = [int(i) for i in input().split()]
p = 10000000
for i in range(100):
    pi = 0
    for j in range(n):
        pi += (x[j] - (i + 1)) ** 2
    if pi < p:
        p = pi
    # else:
    #     break
    # p[i] += (x[j]-(i+1))**2
print(p)

n = int(eval(input()))
x = [int(i) for i in input().split()]
p = 10000000
for i in range(100):
    pi = 0
    for j in range(n):
        pi += (x[j] - (i + 1)) ** 2
    if pi < p:
        p = pi
    else:
        break
        # p[i] += (x[j]-(i+1))**2
print(p)

-    # else: -    #     break -    # p[i] += (x[j]-(i+1))**2 +    else: +        break +        # p[i] += (x[j]-(i+1))**2