N = int(input())
X = list(map(int, input().split()))
count = 0
ave = round(sum(X) / len(X))

for i in X:
  count += (i - ave)**2

print(count) 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 count = 0 count 0 ave = round(sum(X) / len(X)) ave round(sum(X) / len(X)) round sum(X) / len(X) sum(X) sum X len(X) len X for i in X:
  count += (i - ave)**2 i X count += (i - ave)**2 count (i - ave)**2 i - ave i ave 2 print(count) print count count = 0 0 count ave = round(sum(X) / len(X)) round(sum(X) / len(X)) ave N = int(input()) int(input()) N count += (i - ave)**2 (i - ave)**2 count X = list(map(int, input().split())) list(map(int, input().split())) X
N = int(input())
X = list(map(int, input().split()))
count = 0
ave = round(sum(X) / len(X))

for i in X:
  count += (i - ave)**2

print(count)