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