N = int(input())
X_list = list(map(int, input().split()))
X_list_min = sorted(X_list)

ans = 10**8+1

for i in range(X_list_min[0], X_list_min[-1]+1):
    ans_temp = 0
    for j in range(N):
        ans_temp += (X_list_min[j] - i)**2
    ans = min(ans, ans_temp)
print(ans) N = int(input()) N int(input()) int input() input X_list = list(map(int, input().split())) X_list list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split X_list_min = sorted(X_list) X_list_min sorted(X_list) sorted X_list ans = 10**8+1 ans 10**8+1 10**8 10 8 1 for i in range(X_list_min[0], X_list_min[-1]+1):
    ans_temp = 0
    for j in range(N):
        ans_temp += (X_list_min[j] - i)**2
    ans = min(ans, ans_temp) i range(X_list_min[0], X_list_min[-1]+1) range X_list_min[0] X_list_min 0 X_list_min[-1]+1 X_list_min[-1] X_list_min -1 1 ans_temp = 0 ans_temp 0 for j in range(N):
        ans_temp += (X_list_min[j] - i)**2
     j range(N) range N ans_temp += (X_list_min[j] - i)**2 ans_temp (X_list_min[j] - i)**2 X_list_min[j] - i X_list_min[j] X_list_min j i 2 ans = min(ans, ans_temp) ans min(ans, ans_temp) min ans ans_temp print(ans) print ans X_list = list(map(int, input().split())) list(map(int, input().split())) X_list ans_temp += (X_list_min[j] - i)**2 (X_list_min[j] - i)**2 ans_temp N = int(input()) int(input()) N X_list_min = sorted(X_list) sorted(X_list) X_list_min ans = 10**8+1 10**8+1 ans ans_temp = 0 0 ans_temp ans = min(ans, ans_temp) min(ans, ans_temp) ans
N = int(input())
X_list = list(map(int, input().split()))
X_list_min = sorted(X_list)

ans = 10**8+1

for i in range(X_list_min[0], X_list_min[-1]+1):
    ans_temp = 0
    for j in range(N):
        ans_temp += (X_list_min[j] - i)**2
    ans = min(ans, ans_temp)
print(ans)