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

list1.sort()
x=list1[0]
y=list1[-1]

s=0
list2=[]
while x+s<=y:
    list2.append(x+s)
    s=s+1

list3=[]
for j in list2:
    w=0
    for i in list1:
        w=w+(i-j)*(i-j)
    list3.append(w)

list3.sort()
print(list3[0]) N=int(input()) N int(input()) int input() input list1 = list(map(int, input().split())) list1 list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split list1.sort() list1.sort list1 sort x=list1[0] x list1[0] list1 0 y=list1[-1] y list1[-1] list1 -1 s=0 s 0 list2=[] list2 [] while x+s<=y:
    list2.append(x+s)
    s=s+1 x+s<=y x+s x s y list2.append(x+s) list2.append list2 append x+s x s s=s+1 s s+1 s 1 list3=[] list3 [] for j in list2:
    w=0
    for i in list1:
        w=w+(i-j)*(i-j)
    list3.append(w) j list2 w=0 w 0 for i in list1:
        w=w+(i-j)*(i-j)
     i list1 w=w+(i-j)*(i-j) w w+(i-j)*(i-j) w (i-j)*(i-j) i-j i j i-j i j list3.append(w) list3.append list3 append w list3.sort() list3.sort list3 sort print(list3[0]) print list3[0] list3 0 N=int(input()) int(input()) N x=list1[0] list1[0] x list3=[] [] list3 w=w+(i-j)*(i-j) w+(i-j)*(i-j) w list1 = list(map(int, input().split())) list(map(int, input().split())) list1 list2=[] [] list2 y=list1[-1] list1[-1] y s=0 0 s s=s+1 s+1 s w=0 0 w
N=int(input())
list1 = list(map(int, input().split()))

list1.sort()
x=list1[0]
y=list1[-1]

s=0
list2=[]
while x+s<=y:
    list2.append(x+s)
    s=s+1

list3=[]
for j in list2:
    w=0
    for i in list1:
        w=w+(i-j)*(i-j)
    list3.append(w)

list3.sort()
print(list3[0])
