n = int(input())
l = list(map(int, input().split()))
sl = []

ma, mi = max(l), min(l)
if ma == mi:
  sl.append(0)

for x in range(mi, ma):
  s = 0
  for i in l:
    s += (i - x)**2 
  sl.append(s)

print(min(sl)) n = int(input()) n int(input()) int input() input l = list(map(int, input().split())) l list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split sl = [] sl [] ma, mi = max(l), min(l) ma max(l) max l mi min(l) min l if ma == mi:
  sl.append(0) ma == mi ma mi sl.append(0) sl.append sl append 0 for x in range(mi, ma):
  s = 0
  for i in l:
    s += (i - x)**2 
  sl.append(s) x range(mi, ma) range mi ma s = 0 s 0 for i in l:
    s += (i - x)**2 
   i l s += (i - x)**2 s (i - x)**2 i - x i x 2 sl.append(s) sl.append sl append s print(min(sl)) print min(sl) min sl n = int(input()) int(input()) n mi = max(l), min(l) min(l) mi l = list(map(int, input().split())) list(map(int, input().split())) l s = 0 0 s ma, mi = max(l), min(l) max(l) ma sl = [] [] sl s += (i - x)**2 (i - x)**2 s
n = int(input())
l = list(map(int, input().split()))
sl = []

ma, mi = max(l), min(l)
if ma == mi:
  sl.append(0)

for x in range(mi, ma):
  s = 0
  for i in l:
    s += (i - x)**2 
  sl.append(s)

print(min(sl))