N = int(input())
X = list(map(int, input().split()))
X.sort()
ans = 0
data = []

for p in range(X[N-1] + 1):
    sum = 0
    for i in range(len(X)):
         sum += (X[i]-p)**2
         ans = sum
    p += 1
    data.append(ans)

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

for p in range(X[N-1] + 1):
    sum = 0
    for i in range(len(X)):
         sum += (X[i]-p)**2
         ans = sum
    p += 1
    data.append(ans)

print(min(data))
