n=int(input())
l = [int(x) for x in input().split()]
p = int(sum(l)/n + 0.5)
ans = 0
for i in range(n):
    ans += (p-l[i])**2
    
print(ans) n=int(input()) n int(input()) int input() input int(x) for x in input().split() for x in input().split() x input().split() ().split () input split for x in input().split() int(x) int x l = [int(x) for x in input().split()] l [int(x) for x in input().split()] p = int(sum(l)/n + 0.5) p int(sum(l)/n + 0.5) int sum(l)/n + 0.5 sum(l)/n sum(l) sum l n 0.5 ans = 0 ans 0 for i in range(n):
    ans += (p-l[i])**2
     i range(n) range n ans += (p-l[i])**2 ans (p-l[i])**2 p-l[i] p l[i] l i 2 print(ans) print ans ans += (p-l[i])**2 (p-l[i])**2 ans n=int(input()) int(input()) n l = [int(x) for x in input().split()] [int(x) for x in input().split()] l p = int(sum(l)/n + 0.5) int(sum(l)/n + 0.5) p ans = 0 0 ans
n=int(input())
l = [int(x) for x in input().split()]
p = int(sum(l)/n + 0.5)
ans = 0
for i in range(n):
    ans += (p-l[i])**2
    
print(ans)