import numpy as np
N = int(input()) 
X_ls = np.array(list(map(int, input().split())))

#N=2
#X_ls =np.array( [1,4])

ans = 0
for p in range(max(X_ls)+1):
    sub = X_ls-p
    ans_1 = sum(sub**2)
    if ans_1 <= ans or ans ==0:
        ans = ans_1
print(ans) import numpy as np numpy N = int(input()) N int(input()) int input() input X_ls = np.array(list(map(int, input().split()))) X_ls np.array(list(map(int, input().split()))) np.array np array list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split ans = 0 ans 0 for p in range(max(X_ls)+1):
    sub = X_ls-p
    ans_1 = sum(sub**2)
    if ans_1 <= ans or ans ==0:
        ans = ans_1 p range(max(X_ls)+1) range max(X_ls)+1 max(X_ls) max X_ls 1 sub = X_ls-p sub X_ls-p X_ls p ans_1 = sum(sub**2) ans_1 sum(sub**2) sum sub**2 sub 2 if ans_1 <= ans or ans ==0:
        ans = ans_1 ans_1 <= ans or ans ==0 ans_1 <= ans ans_1 ans ans ==0 ans 0 ans = ans_1 ans ans_1 print(ans) print ans N = int(input()) int(input()) N ans = 0 0 ans ans_1 = sum(sub**2) sum(sub**2) ans_1 ans = ans_1 ans_1 ans sub = X_ls-p X_ls-p sub X_ls = np.array(list(map(int, input().split()))) np.array(list(map(int, input().split()))) X_ls
import numpy as np
N = int(input()) 
X_ls = np.array(list(map(int, input().split())))

#N=2
#X_ls =np.array( [1,4])

ans = 0
for p in range(max(X_ls)+1):
    sub = X_ls-p
    ans_1 = sum(sub**2)
    if ans_1 <= ans or ans ==0:
        ans = ans_1
print(ans)