n=int(eval(input()))

l=list(map(int,input().split()))

import statistics as st

m=round(st.mean(l))

print((sum((m-i)**2 for i in l)))
n=int(eval(input()))

l=list(map(int,input().split()))

m=round(sum(l)/n)

print((sum((m-i)**2 for i in l)))
n = int(eval(input()))
l = list(map(int, input().split()))
import statistics as st

m = round(st.mean(l))
print((sum((m - i) ** 2 for i in l)))

n = int(eval(input()))
l = list(map(int, input().split()))
m = round(sum(l) / n)
print((sum((m - i) ** 2 for i in l)))

-import statistics as st - -m = round(st.mean(l)) +m = round(sum(l) / n)