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

x_max = max(x)
x_min = min(x)
hp_min = 10000*100

for p in range(x_min, x_max + 1):
    hp = 0
    for x_i in x:
        hp += (x_i - p)**2
    if hp < hp_min:
        hp_min = hp
    
print(hp_min) 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 x_max = max(x) x_max max(x) max x x_min = min(x) x_min min(x) min x hp_min = 10000*100 hp_min 10000*100 10000 100 for p in range(x_min, x_max + 1):
    hp = 0
    for x_i in x:
        hp += (x_i - p)**2
    if hp < hp_min:
        hp_min = hp
     p range(x_min, x_max + 1) range x_min x_max + 1 x_max 1 hp = 0 hp 0 for x_i in x:
        hp += (x_i - p)**2
     x_i x hp += (x_i - p)**2 hp (x_i - p)**2 x_i - p x_i p 2 if hp < hp_min:
        hp_min = hp
     hp < hp_min hp hp_min hp_min = hp hp_min hp print(hp_min) print hp_min hp += (x_i - p)**2 (x_i - p)**2 hp hp_min = 10000*100 10000*100 hp_min x_max = max(x) max(x) x_max n = int(input()) int(input()) n x_min = min(x) min(x) x_min hp_min = hp hp hp_min hp = 0 0 hp x = list(map(int, input().split())) list(map(int, input().split())) x
n = int(input())
x = list(map(int, input().split()))

x_max = max(x)
x_min = min(x)
hp_min = 10000*100

for p in range(x_min, x_max + 1):
    hp = 0
    for x_i in x:
        hp += (x_i - p)**2
    if hp < hp_min:
        hp_min = hp
    
print(hp_min)