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

ans = float("inf")

for p in range(min(x),max(x)+1):
	t = 0
	for i in x:
		t+=(i-p)**2
	ans = min(ans, t)

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 ans = float("inf") ans float("inf") float "inf" for p in range(min(x),max(x)+1):
	t = 0
	for i in x:
		t+=(i-p)**2
	ans = min(ans, t) p range(min(x),max(x)+1) range min(x) min x max(x)+1 max(x) max x 1 t = 0 t 0 for i in x:
		t+=(i-p)**2
	 i x t+=(i-p)**2 t (i-p)**2 i-p i p 2 ans = min(ans, t) ans min(ans, t) min ans t print(ans) print ans ans = float("inf") float("inf") ans n = int(input()) int(input()) n ans = min(ans, t) min(ans, t) ans x = list(map(int, input().split())) list(map(int, input().split())) x t+=(i-p)**2 (i-p)**2 t t = 0 0 t
n = int(input())
x = list(map(int, input().split()))

ans = float("inf")

for p in range(min(x),max(x)+1):
	t = 0
	for i in x:
		t+=(i-p)**2
	ans = min(ans, t)

print(ans)