
N = int(input())
X = list(map(int, input().split()))
ans = 10e9
for i in range(0,max(X)+1):
    tmp = 0
    for j in range(N):
        tmp += (X[j]-i)**2
    if tmp < ans:
        ans = tmp
#    print(tmp)
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 = 10e9 ans 10e9 for i in range(0,max(X)+1):
    tmp = 0
    for j in range(N):
        tmp += (X[j]-i)**2
    if tmp < ans:
        ans = tmp
#    print(tmp) i range(0,max(X)+1) range 0 max(X)+1 max(X) max X 1 tmp = 0 tmp 0 for j in range(N):
        tmp += (X[j]-i)**2
     j range(N) range N tmp += (X[j]-i)**2 tmp (X[j]-i)**2 X[j]-i X[j] X j i 2 if tmp < ans:
        ans = tmp
#    print(tmp) tmp < ans tmp ans ans = tmp ans tmp print(ans) print ans ans = tmp tmp ans X = list(map(int, input().split())) list(map(int, input().split())) X tmp = 0 0 tmp tmp += (X[j]-i)**2 (X[j]-i)**2 tmp N = int(input()) int(input()) N ans = 10e9 10e9 ans

N = int(input())
X = list(map(int, input().split()))
ans = 10e9
for i in range(0,max(X)+1):
    tmp = 0
    for j in range(N):
        tmp += (X[j]-i)**2
    if tmp < ans:
        ans = tmp
#    print(tmp)
print(ans)

