n = int(input())
line = list(map(int, input().split()))
min_dist = 10**9
for i in range(max(line)+1):
  sum_dist = 0
  for j in range(n):
    sum_dist += (line[j] - i)**2
  if sum_dist < min_dist:
    min_dist = sum_dist
print(min_dist) n = int(input()) n int(input()) int input() input line = list(map(int, input().split())) line list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split min_dist = 10**9 min_dist 10**9 10 9 for i in range(max(line)+1):
  sum_dist = 0
  for j in range(n):
    sum_dist += (line[j] - i)**2
  if sum_dist < min_dist:
    min_dist = sum_dist i range(max(line)+1) range max(line)+1 max(line) max line 1 sum_dist = 0 sum_dist 0 for j in range(n):
    sum_dist += (line[j] - i)**2
   j range(n) range n sum_dist += (line[j] - i)**2 sum_dist (line[j] - i)**2 line[j] - i line[j] line j i 2 if sum_dist < min_dist:
    min_dist = sum_dist sum_dist < min_dist sum_dist min_dist min_dist = sum_dist min_dist sum_dist print(min_dist) print min_dist min_dist = 10**9 10**9 min_dist sum_dist += (line[j] - i)**2 (line[j] - i)**2 sum_dist min_dist = sum_dist sum_dist min_dist n = int(input()) int(input()) n sum_dist = 0 0 sum_dist line = list(map(int, input().split())) list(map(int, input().split())) line
n = int(input())
line = list(map(int, input().split()))
min_dist = 10**9
for i in range(max(line)+1):
  sum_dist = 0
  for j in range(n):
    sum_dist += (line[j] - i)**2
  if sum_dist < min_dist:
    min_dist = sum_dist
print(min_dist)