import math
import statistics
from decimal import Decimal, ROUND_HALF_UP
a = int(input())
b = list(map(int, input().split()))
c = statistics.mean(b)
d = Decimal(c).quantize(Decimal('1'), ROUND_HALF_UP)
ans = 0
for i in range(a):
  ans += (d - b[i])**2
print(ans) import math math import statistics statistics from decimal import Decimal, ROUND_HALF_UP a = int(input()) a int(input()) int input() input b = list(map(int, input().split())) b list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split c = statistics.mean(b) c statistics.mean(b) statistics.mean statistics mean b d = Decimal(c).quantize(Decimal('1'), ROUND_HALF_UP) d Decimal(c).quantize(Decimal('1'), ROUND_HALF_UP) (c).quantize (c) Decimal c quantize Decimal('1') Decimal '1' ROUND_HALF_UP ans = 0 ans 0 for i in range(a):
  ans += (d - b[i])**2 i range(a) range a ans += (d - b[i])**2 ans (d - b[i])**2 d - b[i] d b[i] b i 2 print(ans) print ans b = list(map(int, input().split())) list(map(int, input().split())) b d = Decimal(c).quantize(Decimal('1'), ROUND_HALF_UP) Decimal(c).quantize(Decimal('1'), ROUND_HALF_UP) d a = int(input()) int(input()) a ans = 0 0 ans ans += (d - b[i])**2 (d - b[i])**2 ans c = statistics.mean(b) statistics.mean(b) c
import math
import statistics
from decimal import Decimal, ROUND_HALF_UP
a = int(input())
b = list(map(int, input().split()))
c = statistics.mean(b)
d = Decimal(c).quantize(Decimal('1'), ROUND_HALF_UP)
ans = 0
for i in range(a):
  ans += (d - b[i])**2
print(ans)
