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