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

X.sort()
dist = float("inf")
for i in range(X[0],X[-1]+1):
  d = 0
  for j in range(N):
    d += (i - X[j]) ** 2
  dist = min(dist,d)
  
print(dist) 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.sort() X.sort X sort dist = float("inf") dist float("inf") float "inf" for i in range(X[0],X[-1]+1):
  d = 0
  for j in range(N):
    d += (i - X[j]) ** 2
  dist = min(dist,d)
   i range(X[0],X[-1]+1) range X[0] X 0 X[-1]+1 X[-1] X -1 1 d = 0 d 0 for j in range(N):
    d += (i - X[j]) ** 2
   j range(N) range N d += (i - X[j]) ** 2 d (i - X[j]) ** 2 i - X[j] i X[j] X j 2 dist = min(dist,d) dist min(dist,d) min dist d print(dist) print dist N = int(input()) int(input()) N d = 0 0 d X = list(map(int,input().split())) list(map(int,input().split())) X dist = float("inf") float("inf") dist dist = min(dist,d) min(dist,d) dist d += (i - X[j]) ** 2 (i - X[j]) ** 2 d
N = int(input())
X = list(map(int,input().split()))

X.sort()
dist = float("inf")
for i in range(X[0],X[-1]+1):
  d = 0
  for j in range(N):
    d += (i - X[j]) ** 2
  dist = min(dist,d)
  
print(dist)