N = int(input())
X = list(map(int, input().split()))
a = int(sum(X) / N)
b = a + 1
A, B = 0, 0
for x in X:
    A += (x - a) ** 2
    B += (x - b) ** 2
ans = min(A, B)
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 a = int(sum(X) / N) a int(sum(X) / N) int sum(X) / N sum(X) sum X N b = a + 1 b a + 1 a 1 A, B = 0, 0 A 0 B 0 for x in X:
    A += (x - a) ** 2
    B += (x - b) ** 2 x X A += (x - a) ** 2 A (x - a) ** 2 x - a x a 2 B += (x - b) ** 2 B (x - b) ** 2 x - b x b 2 ans = min(A, B) ans min(A, B) min A B print(ans) print ans a = int(sum(X) / N) int(sum(X) / N) a B = 0, 0 0 B A += (x - a) ** 2 (x - a) ** 2 A B += (x - b) ** 2 (x - b) ** 2 B ans = min(A, B) min(A, B) ans X = list(map(int, input().split())) list(map(int, input().split())) X b = a + 1 a + 1 b A, B = 0, 0 0 A N = int(input()) int(input()) N
N = int(input())
X = list(map(int, input().split()))
a = int(sum(X) / N)
b = a + 1
A, B = 0, 0
for x in X:
    A += (x - a) ** 2
    B += (x - b) ** 2
ans = min(A, B)
print(ans)