N = int(input())
X = list(map(int, input().split()))
sum_min = 10**8

for i in range(min(X), max(X)+1):
    s = 0
    for j in range(N):
        s += (X[j] - i)**2
    
    if s < sum_min:
        sum_min = s

print(sum_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 sum_min = 10**8 sum_min 10**8 10 8 for i in range(min(X), max(X)+1):
    s = 0
    for j in range(N):
        s += (X[j] - i)**2
    
    if s < sum_min:
        sum_min = s i range(min(X), max(X)+1) range min(X) min X max(X)+1 max(X) max X 1 s = 0 s 0 for j in range(N):
        s += (X[j] - i)**2
    
     j range(N) range N s += (X[j] - i)**2 s (X[j] - i)**2 X[j] - i X[j] X j i 2 if s < sum_min:
        sum_min = s s < sum_min s sum_min sum_min = s sum_min s print(sum_min) print sum_min N = int(input()) int(input()) N X = list(map(int, input().split())) list(map(int, input().split())) X sum_min = s s sum_min s = 0 0 s sum_min = 10**8 10**8 sum_min s += (X[j] - i)**2 (X[j] - i)**2 s
N = int(input())
X = list(map(int, input().split()))
sum_min = 10**8

for i in range(min(X), max(X)+1):
    s = 0
    for j in range(N):
        s += (X[j] - i)**2
    
    if s < sum_min:
        sum_min = s

print(sum_min)