n = int(input())
x = list(map(int, input().split()))
m = 10**9
for i in range(min(x),max(x)+1):
    t = 0
    for h in x:
        t += (h-i)**2
    if t < m:
        m = t
print(m) 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 = 10**9 m 10**9 10 9 for i in range(min(x),max(x)+1):
    t = 0
    for h in x:
        t += (h-i)**2
    if t < m:
        m = t i range(min(x),max(x)+1) range min(x) min x max(x)+1 max(x) max x 1 t = 0 t 0 for h in x:
        t += (h-i)**2
     h x t += (h-i)**2 t (h-i)**2 h-i h i 2 if t < m:
        m = t t < m t m m = t m t print(m) print m n = int(input()) int(input()) n t = 0 0 t m = t t m m = 10**9 10**9 m t += (h-i)**2 (h-i)**2 t x = list(map(int, input().split())) list(map(int, input().split())) x
n = int(input())
x = list(map(int, input().split()))
m = 10**9
for i in range(min(x),max(x)+1):
    t = 0
    for h in x:
        t += (h-i)**2
    if t < m:
        m = t
print(m)