# coding: utf-8

N=int(eval(input()))

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

cost=0

for i in range(N):

    cost+=(X[i]-1)**2

for i in range(2,101):

    cost1=0

    for j in range(N):

        cost1+=(X[j]-i)**2

    if cost1<cost:

        cost=cost1

    

print(cost)
# coding: utf-8



N = int(eval(input()))

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

judge = float('inf')

for i in range(1,101):

    p = i

    tmp = 0

    for j in range(N):

        tmp += (X[j]-p)**2

    if tmp < judge:

        judge = tmp

        ans = tmp

        

print(ans)
# coding: utf-8
N = int(eval(input()))
X = list(map(int, input().split()))
cost = 0
for i in range(N):
    cost += (X[i] - 1) ** 2
for i in range(2, 101):
    cost1 = 0
    for j in range(N):
        cost1 += (X[j] - i) ** 2
    if cost1 < cost:
        cost = cost1
print(cost)

# coding: utf-8
N = int(eval(input()))
X = list(map(int, input().split()))
judge = float("inf")
for i in range(1, 101):
    p = i
    tmp = 0
    for j in range(N):
        tmp += (X[j] - p) ** 2
    if tmp < judge:
        judge = tmp
        ans = tmp
print(ans)

-cost = 0 -for i in range(N): -    cost += (X[i] - 1) ** 2 -for i in range(2, 101): -    cost1 = 0 +judge = float("inf") +for i in range(1, 101): +    p = i +    tmp = 0 -        cost1 += (X[j] - i) ** 2 -    if cost1 < cost: -        cost = cost1 -print(cost) +        tmp += (X[j] - p) ** 2 +    if tmp < judge: +        judge = tmp +        ans = tmp +print(ans)