N=int(input())
X=sorted(list(map(int, input().split())))
 
ans =100000000000
tmp=0
cnt=0
 
for i in range(X[0],X[-1]+1):
    for j in range(len(X)):
        tmp += (X[j]-i)**2
    if ans > tmp:
        ans =tmp
    tmp=0
print(ans) N=int(input()) N int(input()) int input() input X=sorted(list(map(int, input().split()))) X sorted(list(map(int, input().split()))) sorted list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split ans =100000000000 ans 100000000000 tmp=0 tmp 0 cnt=0 cnt 0 for i in range(X[0],X[-1]+1):
    for j in range(len(X)):
        tmp += (X[j]-i)**2
    if ans > tmp:
        ans =tmp
    tmp=0 i range(X[0],X[-1]+1) range X[0] X 0 X[-1]+1 X[-1] X -1 1 for j in range(len(X)):
        tmp += (X[j]-i)**2
     j range(len(X)) range len(X) len X tmp += (X[j]-i)**2 tmp (X[j]-i)**2 X[j]-i X[j] X j i 2 if ans > tmp:
        ans =tmp
     ans > tmp ans tmp ans =tmp ans tmp tmp=0 tmp 0 print(ans) print ans X=sorted(list(map(int, input().split()))) sorted(list(map(int, input().split()))) X ans =100000000000 100000000000 ans tmp=0 0 tmp N=int(input()) int(input()) N tmp += (X[j]-i)**2 (X[j]-i)**2 tmp cnt=0 0 cnt ans =tmp tmp ans tmp=0 0 tmp
N=int(input())
X=sorted(list(map(int, input().split())))
 
ans =100000000000
tmp=0
cnt=0
 
for i in range(X[0],X[-1]+1):
    for j in range(len(X)):
        tmp += (X[j]-i)**2
    if ans > tmp:
        ans =tmp
    tmp=0
print(ans)