n=int(input())
x=list(map(int,input().split()))

min_=min(x)
max_=max(x)
ans=list()
for xy in range(min_, max_+1):
  life=0
  for xx in x:
    life+=(xx-xy)**2
  ans.append(life)
print(min(ans)) 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 min_=min(x) min_ min(x) min x max_=max(x) max_ max(x) max x ans=list() ans list() list for xy in range(min_, max_+1):
  life=0
  for xx in x:
    life+=(xx-xy)**2
  ans.append(life) xy range(min_, max_+1) range min_ max_+1 max_ 1 life=0 life 0 for xx in x:
    life+=(xx-xy)**2
   xx x life+=(xx-xy)**2 life (xx-xy)**2 xx-xy xx xy 2 ans.append(life) ans.append ans append life print(min(ans)) print min(ans) min ans min_=min(x) min(x) min_ x=list(map(int,input().split())) list(map(int,input().split())) x life=0 0 life life+=(xx-xy)**2 (xx-xy)**2 life n=int(input()) int(input()) n max_=max(x) max(x) max_ ans=list() list() ans
n=int(input())
x=list(map(int,input().split()))

min_=min(x)
max_=max(x)
ans=list()
for xy in range(min_, max_+1):
  life=0
  for xx in x:
    life+=(xx-xy)**2
  ans.append(life)
print(min(ans))