n=int(input())
x=list(map(int,input().split()))
x.sort()
m=10000000000
for i in range(x[0],x[n-1]+1):
  ans=0
  for j in range(n):
    ans+=(i-x[j])**2
  m=min(m,ans)

print(m) 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 x.sort() x.sort x sort m=10000000000 m 10000000000 for i in range(x[0],x[n-1]+1):
  ans=0
  for j in range(n):
    ans+=(i-x[j])**2
  m=min(m,ans) i range(x[0],x[n-1]+1) range x[0] x 0 x[n-1]+1 x[n-1] x n-1 n 1 1 ans=0 ans 0 for j in range(n):
    ans+=(i-x[j])**2
   j range(n) range n ans+=(i-x[j])**2 ans (i-x[j])**2 i-x[j] i x[j] x j 2 m=min(m,ans) m min(m,ans) min m ans print(m) print m x=list(map(int,input().split())) list(map(int,input().split())) x m=10000000000 10000000000 m ans=0 0 ans ans+=(i-x[j])**2 (i-x[j])**2 ans m=min(m,ans) min(m,ans) m n=int(input()) int(input()) n
n=int(input())
x=list(map(int,input().split()))
x.sort()
m=10000000000
for i in range(x[0],x[n-1]+1):
  ans=0
  for j in range(n):
    ans+=(i-x[j])**2
  m=min(m,ans)

print(m)