N = int(input())
X = list(map(int, input().split()))
P = sum(X) // N
result1 = 0
result2 = 0

for x in X:
  result1 += (x - P)**2
  result2 += (x - P - 1)**2

if result1 <= result2:
  result = result1
elif result1 > result2:
  result = result2


print(result) 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 P = sum(X) // N P sum(X) // N sum(X) sum X N result1 = 0 result1 0 result2 = 0 result2 0 for x in X:
  result1 += (x - P)**2
  result2 += (x - P - 1)**2 x X result1 += (x - P)**2 result1 (x - P)**2 x - P x P 2 result2 += (x - P - 1)**2 result2 (x - P - 1)**2 x - P - 1 x - P x P 1 2 if result1 <= result2:
  result = result1
elif result1 > result2:
  result = result2 result1 <= result2 result1 result2 result = result1 result result1 elif result1 > result2:
  result = result2 result1 > result2 result1 result2 result = result2 result result2 print(result) print result result1 = 0 0 result1 result2 = 0 0 result2 N = int(input()) int(input()) N result = result1 result1 result X = list(map(int, input().split())) list(map(int, input().split())) X P = sum(X) // N sum(X) // N P result1 += (x - P)**2 (x - P)**2 result1 result = result2 result2 result result2 += (x - P - 1)**2 (x - P - 1)**2 result2
N = int(input())
X = list(map(int, input().split()))
P = sum(X) // N
result1 = 0
result2 = 0

for x in X:
  result1 += (x - P)**2
  result2 += (x - P - 1)**2

if result1 <= result2:
  result = result1
elif result1 > result2:
  result = result2


print(result)