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