N=int(input())
*X,=sorted(map(int,input().split()))
a=10**9
for p in range(X[0], X[-1]+1):
 a=min(a, sum((n-p)**2 for n in X))
print(a) N=int(input()) N int(input()) int input() input *X,=sorted(map(int,input().split())) *X X sorted(map(int,input().split())) sorted map(int,input().split()) map int input().split() ().split () input split a=10**9 a 10**9 10 9 for p in range(X[0], X[-1]+1):
 a=min(a, sum((n-p)**2 for n in X)) p range(X[0], X[-1]+1) range X[0] X 0 X[-1]+1 X[-1] X -1 1 a=min(a, sum((n-p)**2 for n in X)) a min(a, sum((n-p)**2 for n in X)) min a sum((n-p)**2 for n in X) sum (n-p)**2 n-p n p 2 print(a) print a N=int(input()) int(input()) N a=10**9 10**9 a a=min(a, sum((n-p)**2 for n in X)) min(a, sum((n-p)**2 for n in X)) a
N=int(input())
*X,=sorted(map(int,input().split()))
a=10**9
for p in range(X[0], X[-1]+1):
 a=min(a, sum((n-p)**2 for n in X))
print(a)