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