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

costs = []
for p in range(100):
  costs.append(sum(map(lambda x: (x - p)**2, X)))

print(min(costs)) 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 costs = [] costs [] for p in range(100):
  costs.append(sum(map(lambda x: (x - p)**2, X))) p range(100) range 100 costs.append(sum(map(lambda x: (x - p)**2, X))) costs.append costs append sum(map(lambda x: (x - p)**2, X)) sum map(lambda x: (x - p)**2, X) map lambda x: (x - p)**2 (x - p)**2 x - p x p 2 x X print(min(costs)) print min(costs) min costs X = list(map(int, input().split())) list(map(int, input().split())) X costs = [] [] costs N = int(input()) int(input()) N
N = int(input())
X = list(map(int, input().split()))

costs = []
for p in range(100):
  costs.append(sum(map(lambda x: (x - p)**2, X)))

print(min(costs))