N = int(input())
X = list(map(int,input().split()))
ans = 10**9
for k in range(min(X),max(X)+1):
    temp = 0
    for e in X:
        temp += (k-e)**2
    ans = min(temp,ans)
print(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 ans = 10**9 ans 10**9 10 9 for k in range(min(X),max(X)+1):
    temp = 0
    for e in X:
        temp += (k-e)**2
    ans = min(temp,ans) k range(min(X),max(X)+1) range min(X) min X max(X)+1 max(X) max X 1 temp = 0 temp 0 for e in X:
        temp += (k-e)**2
     e X temp += (k-e)**2 temp (k-e)**2 k-e k e 2 ans = min(temp,ans) ans min(temp,ans) min temp ans print(ans) print ans X = list(map(int,input().split())) list(map(int,input().split())) X ans = 10**9 10**9 ans ans = min(temp,ans) min(temp,ans) ans temp += (k-e)**2 (k-e)**2 temp temp = 0 0 temp N = int(input()) int(input()) N
N = int(input())
X = list(map(int,input().split()))
ans = 10**9
for k in range(min(X),max(X)+1):
    temp = 0
    for e in X:
        temp += (k-e)**2
    ans = min(temp,ans)
print(ans)
