N = int(input())
X = [int(i) for i in input().split()]

a = min(X)
b = max(X)

s = 10**6
for i in range(a, b+1):
    t = 0
    for j in range(N):
        t += (X[j] - i)**2
    if t < s:
        s = t

print(s) N = int(input()) N int(input()) int input() input int(i) for i in input().split() for i in input().split() i input().split() ().split () input split for i in input().split() int(i) int i X = [int(i) for i in input().split()] X [int(i) for i in input().split()] a = min(X) a min(X) min X b = max(X) b max(X) max X s = 10**6 s 10**6 10 6 for i in range(a, b+1):
    t = 0
    for j in range(N):
        t += (X[j] - i)**2
    if t < s:
        s = t i range(a, b+1) range a b+1 b 1 t = 0 t 0 for j in range(N):
        t += (X[j] - i)**2
     j range(N) range N t += (X[j] - i)**2 t (X[j] - i)**2 X[j] - i X[j] X j i 2 if t < s:
        s = t t < s t s s = t s t print(s) print s X = [int(i) for i in input().split()] [int(i) for i in input().split()] X t += (X[j] - i)**2 (X[j] - i)**2 t N = int(input()) int(input()) N s = 10**6 10**6 s s = t t s b = max(X) max(X) b t = 0 0 t a = min(X) min(X) a
N = int(input())
X = [int(i) for i in input().split()]

a = min(X)
b = max(X)

s = 10**6
for i in range(a, b+1):
    t = 0
    for j in range(N):
        t += (X[j] - i)**2
    if t < s:
        s = t

print(s)