N = int(input())
X = list(map(int, input().split()))

import math

X_min = math.floor(min(X))
X_max = math.ceil(max(X))

c = [0] * (X_max - X_min + 1)

for i in range(X_min, X_max+1):
  for j in range(N):
    c[int(i)-X_min] += (X[j] - i)**2
    
d = min(c)
print(d) 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 import math math X_min = math.floor(min(X)) X_min math.floor(min(X)) math.floor math floor min(X) min X X_max = math.ceil(max(X)) X_max math.ceil(max(X)) math.ceil math ceil max(X) max X c = [0] * (X_max - X_min + 1) c [0] * (X_max - X_min + 1) [0] 0 X_max - X_min + 1 X_max - X_min X_max X_min 1 for i in range(X_min, X_max+1):
  for j in range(N):
    c[int(i)-X_min] += (X[j] - i)**2
     i range(X_min, X_max+1) range X_min X_max+1 X_max 1 for j in range(N):
    c[int(i)-X_min] += (X[j] - i)**2
     j range(N) range N c[int(i)-X_min] += (X[j] - i)**2 c[int(i)-X_min] c int(i)-X_min int(i) int i X_min (X[j] - i)**2 X[j] - i X[j] X j i 2 d = min(c) d min(c) min c print(d) print d d = min(c) min(c) d X = list(map(int, input().split())) list(map(int, input().split())) X c = [0] * (X_max - X_min + 1) [0] * (X_max - X_min + 1) c N = int(input()) int(input()) N X_max = math.ceil(max(X)) math.ceil(max(X)) X_max X_min = math.floor(min(X)) math.floor(min(X)) X_min
N = int(input())
X = list(map(int, input().split()))

import math

X_min = math.floor(min(X))
X_max = math.ceil(max(X))

c = [0] * (X_max - X_min + 1)

for i in range(X_min, X_max+1):
  for j in range(N):
    c[int(i)-X_min] += (X[j] - i)**2
    
d = min(c)
print(d)