n= int(input())
x= list(map(int,input().split()))
m= sum(x)/len(x)
g= int(m)
ans=0
if m-g<g+1-m:
  ans=g
else:
  ans=g+1
aaa=0
for i in x:
  aaa+= (ans-i)**2
print(aaa) 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 m= sum(x)/len(x) m sum(x)/len(x) sum(x) sum x len(x) len x g= int(m) g int(m) int m ans=0 ans 0 if m-g<g+1-m:
  ans=g
else:
  ans=g+1 m-g<g+1-m m-g m g g+1-m g+1 g 1 m ans=g ans g ans=g+1 ans g+1 g 1 aaa=0 aaa 0 for i in x:
  aaa+= (ans-i)**2 i x aaa+= (ans-i)**2 aaa (ans-i)**2 ans-i ans i 2 print(aaa) print aaa g= int(m) int(m) g aaa=0 0 aaa n= int(input()) int(input()) n ans=g+1 g+1 ans x= list(map(int,input().split())) list(map(int,input().split())) x ans=0 0 ans aaa+= (ans-i)**2 (ans-i)**2 aaa ans=g g ans m= sum(x)/len(x) sum(x)/len(x) m
n= int(input())
x= list(map(int,input().split()))
m= sum(x)/len(x)
g= int(m)
ans=0
if m-g<g+1-m:
  ans=g
else:
  ans=g+1
aaa=0
for i in x:
  aaa+= (ans-i)**2
print(aaa)