n = int(input())
X = list(map(int, input().split()))
x_min = min(X)
x_max = max(X)

min_val = 10**6 + 1

for i in range(x_min, x_max + 1):
    min_val = min(min_val, sum(map(lambda x: (x-i)**2, X)))

print(min_val) 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_min = min(X) x_min min(X) min X x_max = max(X) x_max max(X) max X min_val = 10**6 + 1 min_val 10**6 + 1 10**6 10 6 1 for i in range(x_min, x_max + 1):
    min_val = min(min_val, sum(map(lambda x: (x-i)**2, X))) i range(x_min, x_max + 1) range x_min x_max + 1 x_max 1 min_val = min(min_val, sum(map(lambda x: (x-i)**2, X))) min_val min(min_val, sum(map(lambda x: (x-i)**2, X))) min min_val sum(map(lambda x: (x-i)**2, X)) sum map(lambda x: (x-i)**2, X) map lambda x: (x-i)**2 (x-i)**2 x-i x i 2 x X print(min_val) print min_val x_max = max(X) max(X) x_max X = list(map(int, input().split())) list(map(int, input().split())) X min_val = min(min_val, sum(map(lambda x: (x-i)**2, X))) min(min_val, sum(map(lambda x: (x-i)**2, X))) min_val x_min = min(X) min(X) x_min n = int(input()) int(input()) n min_val = 10**6 + 1 10**6 + 1 min_val
n = int(input())
X = list(map(int, input().split()))
x_min = min(X)
x_max = max(X)

min_val = 10**6 + 1

for i in range(x_min, x_max + 1):
    min_val = min(min_val, sum(map(lambda x: (x-i)**2, X)))

print(min_val)