N=int(input())
X=list(map(int, input().split()))
import numpy as np
p=np.floor(np.mean(X))
ans=min(np.sum([(x-p)**2 for x in X]), np.sum([(x-(p+1))**2 for x in X]))

print(int(ans)) 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 import numpy as np numpy p=np.floor(np.mean(X)) p np.floor(np.mean(X)) np.floor np floor np.mean(X) np.mean np mean X (x-p)**2 for x in X for x in X x X for x in X (x-p)**2 x-p x p 2 ans=min(np.sum([(x-p)**2 for x in X]), np.sum([(x-(p+1))**2 for x in X])) ans min(np.sum([(x-p)**2 for x in X]), np.sum([(x-(p+1))**2 for x in X])) min np.sum([(x-p)**2 for x in X]) np.sum np sum [(x-p)**2 for x in X] np.sum([(x-(p+1))**2 for x in X]) np.sum np sum [(x-(p+1))**2 for x in X] print(int(ans)) print int(ans) int ans X=list(map(int, input().split())) list(map(int, input().split())) X p=np.floor(np.mean(X)) np.floor(np.mean(X)) p N=int(input()) int(input()) N ans=min(np.sum([(x-p)**2 for x in X]), np.sum([(x-(p+1))**2 for x in X])) min(np.sum([(x-p)**2 for x in X]), np.sum([(x-(p+1))**2 for x in X])) ans
N=int(input())
X=list(map(int, input().split()))
import numpy as np
p=np.floor(np.mean(X))
ans=min(np.sum([(x-p)**2 for x in X]), np.sum([(x-(p+1))**2 for x in X]))

print(int(ans))