# coding: utf-8
# Your code here!

n=int(input())
x=list(map(int,input().split()))
cost_min=1000000000
for i in range(1,101):
    cost=0
    for j in x:
        cost+=(j-i)**2
    if cost>=cost_min:
        continue
    cost_min=cost
print(cost_min) n=int(input()) n int(input()) int input() input x=list(map(int,input().split())) x list(map(int,input().split())) list map(int,input().split()) map int input().split() ().split () input split cost_min=1000000000 cost_min 1000000000 for i in range(1,101):
    cost=0
    for j in x:
        cost+=(j-i)**2
    if cost>=cost_min:
        continue
    cost_min=cost i range(1,101) range 1 101 cost=0 cost 0 for j in x:
        cost+=(j-i)**2
     j x cost+=(j-i)**2 cost (j-i)**2 j-i j i 2 if cost>=cost_min:
        continue
     cost>=cost_min cost cost_min continue cost_min=cost cost_min cost print(cost_min) print cost_min x=list(map(int,input().split())) list(map(int,input().split())) x cost_min=1000000000 1000000000 cost_min cost_min=cost cost cost_min n=int(input()) int(input()) n cost=0 0 cost cost+=(j-i)**2 (j-i)**2 cost
# coding: utf-8
# Your code here!

n=int(input())
x=list(map(int,input().split()))
cost_min=1000000000
for i in range(1,101):
    cost=0
    for j in x:
        cost+=(j-i)**2
    if cost>=cost_min:
        continue
    cost_min=cost
print(cost_min)