N = int(input())
X = list(map(int,input().split()))
ans = float("inf")
for loc in range(-100,101):
  temp = 0
  for x in X:
    temp += (loc-x)**2
  ans = min(temp,ans)
print(ans) N = int(input()) N int(input()) int input() input X = list(map(int,input().split())) X list(map(int,input().split())) list map(int,input().split()) map int input().split() ().split () input split ans = float("inf") ans float("inf") float "inf" for loc in range(-100,101):
  temp = 0
  for x in X:
    temp += (loc-x)**2
  ans = min(temp,ans) loc range(-100,101) range -100 101 temp = 0 temp 0 for x in X:
    temp += (loc-x)**2
   x X temp += (loc-x)**2 temp (loc-x)**2 loc-x loc x 2 ans = min(temp,ans) ans min(temp,ans) min temp ans print(ans) print ans X = list(map(int,input().split())) list(map(int,input().split())) X temp += (loc-x)**2 (loc-x)**2 temp ans = min(temp,ans) min(temp,ans) ans N = int(input()) int(input()) N ans = float("inf") float("inf") ans temp = 0 0 temp
N = int(input())
X = list(map(int,input().split()))
ans = float("inf")
for loc in range(-100,101):
  temp = 0
  for x in X:
    temp += (loc-x)**2
  ans = min(temp,ans)
print(ans)