n=int(input())
x = [int(x) for x in input().split()]

heikin=(sum(x)/n)

if abs(int(heikin)-heikin)<abs(int(heikin+1)-heikin):
    kaisai=int(heikin)
else:
    kaisai=int(heikin+1)

ans=0

for i in x:
    ans+=(i-kaisai)**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 x = [int(x) for x in input().split()] x [int(x) for x in input().split()] heikin=(sum(x)/n) heikin sum(x)/n sum(x) sum x n if abs(int(heikin)-heikin)<abs(int(heikin+1)-heikin):
    kaisai=int(heikin)
else:
    kaisai=int(heikin+1) abs(int(heikin)-heikin)<abs(int(heikin+1)-heikin) abs(int(heikin)-heikin) abs int(heikin)-heikin int(heikin) int heikin heikin abs(int(heikin+1)-heikin) abs int(heikin+1)-heikin int(heikin+1) int heikin+1 heikin 1 heikin kaisai=int(heikin) kaisai int(heikin) int heikin kaisai=int(heikin+1) kaisai int(heikin+1) int heikin+1 heikin 1 ans=0 ans 0 for i in x:
    ans+=(i-kaisai)**2 i x ans+=(i-kaisai)**2 ans (i-kaisai)**2 i-kaisai i kaisai 2 print(ans) print ans x = [int(x) for x in input().split()] [int(x) for x in input().split()] x kaisai=int(heikin) int(heikin) kaisai ans=0 0 ans ans+=(i-kaisai)**2 (i-kaisai)**2 ans n=int(input()) int(input()) n heikin=(sum(x)/n) sum(x)/n heikin kaisai=int(heikin+1) int(heikin+1) kaisai
n=int(input())
x = [int(x) for x in input().split()]

heikin=(sum(x)/n)

if abs(int(heikin)-heikin)<abs(int(heikin+1)-heikin):
    kaisai=int(heikin)
else:
    kaisai=int(heikin+1)

ans=0

for i in x:
    ans+=(i-kaisai)**2

print(ans)