num = int(input())
pos = list(map(int,input().split()))
maxpos = max(pos)
minhealth = 1e9
count = 0
for i in range(maxpos+1):
    for j in pos:
        count += (j-i)**2
    minhealth = min(minhealth, count)
    count = 0
print(minhealth) num = int(input()) num int(input()) int input() input pos = list(map(int,input().split())) pos list(map(int,input().split())) list map(int,input().split()) map int input().split() ().split () input split maxpos = max(pos) maxpos max(pos) max pos minhealth = 1e9 minhealth 1e9 count = 0 count 0 for i in range(maxpos+1):
    for j in pos:
        count += (j-i)**2
    minhealth = min(minhealth, count)
    count = 0 i range(maxpos+1) range maxpos+1 maxpos 1 for j in pos:
        count += (j-i)**2
     j pos count += (j-i)**2 count (j-i)**2 j-i j i 2 minhealth = min(minhealth, count) minhealth min(minhealth, count) min minhealth count count = 0 count 0 print(minhealth) print minhealth minhealth = 1e9 1e9 minhealth count = 0 0 count count = 0 0 count count += (j-i)**2 (j-i)**2 count minhealth = min(minhealth, count) min(minhealth, count) minhealth maxpos = max(pos) max(pos) maxpos num = int(input()) int(input()) num pos = list(map(int,input().split())) list(map(int,input().split())) pos
num = int(input())
pos = list(map(int,input().split()))
maxpos = max(pos)
minhealth = 1e9
count = 0
for i in range(maxpos+1):
    for j in pos:
        count += (j-i)**2
    minhealth = min(minhealth, count)
    count = 0
print(minhealth)
