N = int(input())
X_ls = list(map(int, input().split(' ')))
rst = -1
for i in range(min(X_ls), max(X_ls) + 1):
    val = 0
    for j in X_ls:
        val += (i - j) ** 2
    if rst == -1:
        rst = val
    else:
        rst = min(rst, val)
print(rst) N = int(input()) N int(input()) int input() input X_ls = list(map(int, input().split(' '))) X_ls list(map(int, input().split(' '))) list map(int, input().split(' ')) map int input().split(' ') ().split () input split ' ' rst = -1 rst -1 for i in range(min(X_ls), max(X_ls) + 1):
    val = 0
    for j in X_ls:
        val += (i - j) ** 2
    if rst == -1:
        rst = val
    else:
        rst = min(rst, val) i range(min(X_ls), max(X_ls) + 1) range min(X_ls) min X_ls max(X_ls) + 1 max(X_ls) max X_ls 1 val = 0 val 0 for j in X_ls:
        val += (i - j) ** 2
     j X_ls val += (i - j) ** 2 val (i - j) ** 2 i - j i j 2 if rst == -1:
        rst = val
    else:
        rst = min(rst, val) rst == -1 rst -1 rst = val rst val rst = min(rst, val) rst min(rst, val) min rst val print(rst) print rst val += (i - j) ** 2 (i - j) ** 2 val N = int(input()) int(input()) N rst = min(rst, val) min(rst, val) rst val = 0 0 val X_ls = list(map(int, input().split(' '))) list(map(int, input().split(' '))) X_ls rst = val val rst rst = -1 -1 rst
N = int(input())
X_ls = list(map(int, input().split(' ')))
rst = -1
for i in range(min(X_ls), max(X_ls) + 1):
    val = 0
    for j in X_ls:
        val += (i - j) ** 2
    if rst == -1:
        rst = val
    else:
        rst = min(rst, val)
print(rst)