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