N = int(input())
X = list(map(int, input().split()))
 
def calc_power(p):
  P = list(map(lambda x: (x-p)**2, X))
  return sum(P)
 
power = []
_min = min(X)
_max = max(X)

if _min != _max:
  for p in range(_min, _max):
    power.append(calc_power(p))
  print(min(power))
  
else:
  power = calc_power(_min)
  print(power) 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 def calc_power(p):
  P = list(map(lambda x: (x-p)**2, X))
  return sum(P)
  calc_power P = list(map(lambda x: (x-p)**2, X)) P list(map(lambda x: (x-p)**2, X)) list map(lambda x: (x-p)**2, X) map lambda x: (x-p)**2 (x-p)**2 x-p x p 2 x X return sum(P) sum(P) sum P p p power = [] power [] _min = min(X) _min min(X) min X _max = max(X) _max max(X) max X if _min != _max:
  for p in range(_min, _max):
    power.append(calc_power(p))
  print(min(power))
  
else:
  power = calc_power(_min)
  print(power) _min != _max _min _max for p in range(_min, _max):
    power.append(calc_power(p))
   p range(_min, _max) range _min _max power.append(calc_power(p)) power.append power append calc_power(p) calc_power p print(min(power)) print min(power) min power power = calc_power(_min) power calc_power(_min) calc_power _min print(power) print power N = int(input()) int(input()) N def calc_power(p):
  P = list(map(lambda x: (x-p)**2, X))
  return sum(P)
  def calc_power(p):
  P = list(map(lambda x: (x-p)**2, X))
  return sum(P)
  calc_power power = calc_power(_min) calc_power(_min) power X = list(map(int, input().split())) list(map(int, input().split())) X _min = min(X) min(X) _min power = [] [] power _max = max(X) max(X) _max
N = int(input())
X = list(map(int, input().split()))
 
def calc_power(p):
  P = list(map(lambda x: (x-p)**2, X))
  return sum(P)
 
power = []
_min = min(X)
_max = max(X)

if _min != _max:
  for p in range(_min, _max):
    power.append(calc_power(p))
  print(min(power))
  
else:
  power = calc_power(_min)
  print(power)