n = int(input())
points = list(map(int, input().split()))

sum = 0
for i in points:
  sum += i

mean = sum/len(points)
if mean%2 != 0:
    mean = int(round(mean,0))

ans = 0
for i in points:
  ans += (i - mean)**2

print(ans) n = int(input()) n int(input()) int input() input points = list(map(int, input().split())) points list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split sum = 0 sum 0 for i in points:
  sum += i i points sum += i sum i mean = sum/len(points) mean sum/len(points) sum len(points) len points if mean%2 != 0:
    mean = int(round(mean,0)) mean%2 != 0 mean%2 mean 2 0 mean = int(round(mean,0)) mean int(round(mean,0)) int round(mean,0) round mean 0 ans = 0 ans 0 for i in points:
  ans += (i - mean)**2 i points ans += (i - mean)**2 ans (i - mean)**2 i - mean i mean 2 print(ans) print ans sum = 0 0 sum ans = 0 0 ans ans += (i - mean)**2 (i - mean)**2 ans mean = sum/len(points) sum/len(points) mean sum += i i sum mean = int(round(mean,0)) int(round(mean,0)) mean n = int(input()) int(input()) n points = list(map(int, input().split())) list(map(int, input().split())) points
n = int(input())
points = list(map(int, input().split()))

sum = 0
for i in points:
  sum += i

mean = sum/len(points)
if mean%2 != 0:
    mean = int(round(mean,0))

ans = 0
for i in points:
  ans += (i - mean)**2

print(ans)