N = int(input())
X = list(map(int, input().split()))

total_list = []
for p in range(min(X), max(X) + 1):
    total = 0
    for x in X:
        total += (x - p) ** 2
    total_list.append(total)

print(min(total_list)) 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 total_list = [] total_list [] for p in range(min(X), max(X) + 1):
    total = 0
    for x in X:
        total += (x - p) ** 2
    total_list.append(total) p range(min(X), max(X) + 1) range min(X) min X max(X) + 1 max(X) max X 1 total = 0 total 0 for x in X:
        total += (x - p) ** 2
     x X total += (x - p) ** 2 total (x - p) ** 2 x - p x p 2 total_list.append(total) total_list.append total_list append total print(min(total_list)) print min(total_list) min total_list X = list(map(int, input().split())) list(map(int, input().split())) X total = 0 0 total N = int(input()) int(input()) N total_list = [] [] total_list total += (x - p) ** 2 (x - p) ** 2 total
N = int(input())
X = list(map(int, input().split()))

total_list = []
for p in range(min(X), max(X) + 1):
    total = 0
    for x in X:
        total += (x - p) ** 2
    total_list.append(total)

print(min(total_list))