import numpy as np



N = int(eval(input()))

X = np.array(list(int(x) for x in input().split()))

m = round(np.mean(X))



print((int(sum((X-m)**2))))
N = int(eval(input()))

X = list(int(x) for x in input().split())

p = round(sum(X)/len(X))

ans = 0



for i in range(N):

    ans += (X[i] - p)**2



print(ans)
import numpy as np

N = int(eval(input()))
X = np.array(list(int(x) for x in input().split()))
m = round(np.mean(X))
print((int(sum((X - m) ** 2))))

N = int(eval(input()))
X = list(int(x) for x in input().split())
p = round(sum(X) / len(X))
ans = 0
for i in range(N):
    ans += (X[i] - p) ** 2
print(ans)

-import numpy as np - -X = np.array(list(int(x) for x in input().split())) -m = round(np.mean(X)) -print((int(sum((X - m) ** 2)))) +X = list(int(x) for x in input().split()) +p = round(sum(X) / len(X)) +ans = 0 +for i in range(N): +    ans += (X[i] - p) ** 2 +print(ans)