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

health = 10**9
p_min = min(x)
p_max = max(x)
for p in range(p_min,p_max+1):
  tmp = 0
  for i in range(n):
    tmp += (x[i]-p)**2
    
  health = min(health, tmp)
print(health) 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 health = 10**9 health 10**9 10 9 p_min = min(x) p_min min(x) min x p_max = max(x) p_max max(x) max x for p in range(p_min,p_max+1):
  tmp = 0
  for i in range(n):
    tmp += (x[i]-p)**2
    
  health = min(health, tmp) p range(p_min,p_max+1) range p_min p_max+1 p_max 1 tmp = 0 tmp 0 for i in range(n):
    tmp += (x[i]-p)**2
    
   i range(n) range n tmp += (x[i]-p)**2 tmp (x[i]-p)**2 x[i]-p x[i] x i p 2 health = min(health, tmp) health min(health, tmp) min health tmp print(health) print health health = 10**9 10**9 health tmp = 0 0 tmp p_max = max(x) max(x) p_max tmp += (x[i]-p)**2 (x[i]-p)**2 tmp p_min = min(x) min(x) p_min n=int(input()) int(input()) n health = min(health, tmp) min(health, tmp) health x=list(map(int,input().split())) list(map(int,input().split())) x
n=int(input())
x=list(map(int,input().split()))

health = 10**9
p_min = min(x)
p_max = max(x)
for p in range(p_min,p_max+1):
  tmp = 0
  for i in range(n):
    tmp += (x[i]-p)**2
    
  health = min(health, tmp)
print(health)