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

minimum = 10000000

for n in range(1,max(X)+1):
  kyori = 0
  for i in range(N):
    kyori += (X[i]-n)**2
  if kyori < minimum:
    minimum = kyori
print(minimum) 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 minimum = 10000000 minimum 10000000 for n in range(1,max(X)+1):
  kyori = 0
  for i in range(N):
    kyori += (X[i]-n)**2
  if kyori < minimum:
    minimum = kyori n range(1,max(X)+1) range 1 max(X)+1 max(X) max X 1 kyori = 0 kyori 0 for i in range(N):
    kyori += (X[i]-n)**2
   i range(N) range N kyori += (X[i]-n)**2 kyori (X[i]-n)**2 X[i]-n X[i] X i n 2 if kyori < minimum:
    minimum = kyori kyori < minimum kyori minimum minimum = kyori minimum kyori print(minimum) print minimum minimum = 10000000 10000000 minimum kyori += (X[i]-n)**2 (X[i]-n)**2 kyori kyori = 0 0 kyori X = list(map(int,input().split())) list(map(int,input().split())) X minimum = kyori kyori minimum N = int(input()) int(input()) N
N = int(input())
X = list(map(int,input().split()))

minimum = 10000000

for n in range(1,max(X)+1):
  kyori = 0
  for i in range(N):
    kyori += (X[i]-n)**2
  if kyori < minimum:
    minimum = kyori
print(minimum)