input()
*X,=sorted(map(int,input().split()))
print(min(sum((n-p)**2 for n in X) for p in range(X[0], X[-1]+1))) 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 print(min(sum((n-p)**2 for n in X) for p in range(X[0], X[-1]+1))) print min(sum((n-p)**2 for n in X) for p in range(X[0], X[-1]+1)) min sum((n-p)**2 for n in X) sum (n-p)**2 n-p n p 2
input()
*X,=sorted(map(int,input().split()))
print(min(sum((n-p)**2 for n in X) for p in range(X[0], X[-1]+1)))