def calc_tairyoku(x, p):
    return (x - p) ** 2

N = int(input())
X = list(map(int, input().split()))
X = sorted(X)
min_x = X[0]
max_x = X[N-1]

result = 10 ** 6
for x in range(min_x, max_x+1):
    s = sum([calc_tairyoku(x, i) for i in X])
    result = min(result, s)

print(result)
     def calc_tairyoku(x, p):
    return (x - p) ** 2 calc_tairyoku return (x - p) ** 2 (x - p) ** 2 x - p x p 2 x x p p 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 X = sorted(X) X sorted(X) sorted X min_x = X[0] min_x X[0] X 0 max_x = X[N-1] max_x X[N-1] X N-1 N 1 result = 10 ** 6 result 10 ** 6 10 6 for x in range(min_x, max_x+1):
    s = sum([calc_tairyoku(x, i) for i in X])
    result = min(result, s) x range(min_x, max_x+1) range min_x max_x+1 max_x 1 calc_tairyoku(x, i) for i in X for i in X i X for i in X calc_tairyoku(x, i) calc_tairyoku x i s = sum([calc_tairyoku(x, i) for i in X]) s sum([calc_tairyoku(x, i) for i in X]) sum [calc_tairyoku(x, i) for i in X] result = min(result, s) result min(result, s) min result s print(result) print result result = min(result, s) min(result, s) result N = int(input()) int(input()) N X = list(map(int, input().split())) list(map(int, input().split())) X X = sorted(X) sorted(X) X max_x = X[N-1] X[N-1] max_x def calc_tairyoku(x, p):
    return (x - p) ** 2 def calc_tairyoku(x, p):
    return (x - p) ** 2 calc_tairyoku s = sum([calc_tairyoku(x, i) for i in X]) sum([calc_tairyoku(x, i) for i in X]) s min_x = X[0] X[0] min_x result = 10 ** 6 10 ** 6 result
def calc_tairyoku(x, p):
    return (x - p) ** 2

N = int(input())
X = list(map(int, input().split()))
X = sorted(X)
min_x = X[0]
max_x = X[N-1]

result = 10 ** 6
for x in range(min_x, max_x+1):
    s = sum([calc_tairyoku(x, i) for i in X])
    result = min(result, s)

print(result)
    
