N = int(input())
X = list(map(int,input().split()))
ans = []
for i in range(max(X)):
  P = i+1
  sum = 0
  for j in range(N):
    sum += (X[j]-P)**2
  ans.append(sum)

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

print(min(ans))