n = int(input())
x = [int(y.strip()) for y in input().split()]
lower = min(x)
upper = max(x)
i = lower
ans = 10000*100
for i in range(upper+1):
  ttl = 0
  for j in x:
    dist = (j - i)**2
    ttl = ttl + dist
  if ttl < ans:
    ans = ttl
print(ans) n = int(input()) n int(input()) int input() input int(y.strip()) for y in input().split() for y in input().split() y input().split() ().split () input split for y in input().split() int(y.strip()) int y.strip() y.strip y strip x = [int(y.strip()) for y in input().split()] x [int(y.strip()) for y in input().split()] lower = min(x) lower min(x) min x upper = max(x) upper max(x) max x i = lower i lower ans = 10000*100 ans 10000*100 10000 100 for i in range(upper+1):
  ttl = 0
  for j in x:
    dist = (j - i)**2
    ttl = ttl + dist
  if ttl < ans:
    ans = ttl i range(upper+1) range upper+1 upper 1 ttl = 0 ttl 0 for j in x:
    dist = (j - i)**2
    ttl = ttl + dist
   j x dist = (j - i)**2 dist (j - i)**2 j - i j i 2 ttl = ttl + dist ttl ttl + dist ttl dist if ttl < ans:
    ans = ttl ttl < ans ttl ans ans = ttl ans ttl print(ans) print ans n = int(input()) int(input()) n x = [int(y.strip()) for y in input().split()] [int(y.strip()) for y in input().split()] x ans = 10000*100 10000*100 ans i = lower lower i upper = max(x) max(x) upper ttl = 0 0 ttl ttl = ttl + dist ttl + dist ttl dist = (j - i)**2 (j - i)**2 dist ans = ttl ttl ans lower = min(x) min(x) lower
n = int(input())
x = [int(y.strip()) for y in input().split()]
lower = min(x)
upper = max(x)
i = lower
ans = 10000*100
for i in range(upper+1):
  ttl = 0
  for j in x:
    dist = (j - i)**2
    ttl = ttl + dist
  if ttl < ans:
    ans = ttl
print(ans)