n = int(input())
x = list(map(int, input().split()))
ans = 1000000000
for p in range(min(x), max(x) + 1):
    a = 0
    for j in range(n):
        a += (p - x[j]) ** 2
    ans = min(a, ans)
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 = 1000000000 ans 1000000000 for p in range(min(x), max(x) + 1):
    a = 0
    for j in range(n):
        a += (p - x[j]) ** 2
    ans = min(a, ans) p range(min(x), max(x) + 1) range min(x) min x max(x) + 1 max(x) max x 1 a = 0 a 0 for j in range(n):
        a += (p - x[j]) ** 2
     j range(n) range n a += (p - x[j]) ** 2 a (p - x[j]) ** 2 p - x[j] p x[j] x j 2 ans = min(a, ans) ans min(a, ans) min a ans print(ans) print ans ans = 1000000000 1000000000 ans n = int(input()) int(input()) n x = list(map(int, input().split())) list(map(int, input().split())) x a += (p - x[j]) ** 2 (p - x[j]) ** 2 a a = 0 0 a ans = min(a, ans) min(a, ans) ans
n = int(input())
x = list(map(int, input().split()))
ans = 1000000000
for p in range(min(x), max(x) + 1):
    a = 0
    for j in range(n):
        a += (p - x[j]) ** 2
    ans = min(a, ans)
print(ans)