N,*X = map(int, open(0).read().split())
ans = float('inf')
for i in range(1,max(X)+1):
    temp = 0
    for j in range(N):
        temp += (X[j]-i) ** 2
    ans = min(ans,temp)
print(ans) N,*X = map(int, open(0).read().split()) N map(int, open(0).read().split()) map int open(0).read().split() (0).read().split (0).read() (0).read (0) open 0 read split *X X ans = float('inf') ans float('inf') float 'inf' for i in range(1,max(X)+1):
    temp = 0
    for j in range(N):
        temp += (X[j]-i) ** 2
    ans = min(ans,temp) i range(1,max(X)+1) range 1 max(X)+1 max(X) max X 1 temp = 0 temp 0 for j in range(N):
        temp += (X[j]-i) ** 2
     j range(N) range N temp += (X[j]-i) ** 2 temp (X[j]-i) ** 2 X[j]-i X[j] X j i 2 ans = min(ans,temp) ans min(ans,temp) min ans temp print(ans) print ans ans = min(ans,temp) min(ans,temp) ans temp = 0 0 temp ans = float('inf') float('inf') ans N,*X = map(int, open(0).read().split()) map(int, open(0).read().split()) N temp += (X[j]-i) ** 2 (X[j]-i) ** 2 temp
N,*X = map(int, open(0).read().split())
ans = float('inf')
for i in range(1,max(X)+1):
    temp = 0
    for j in range(N):
        temp += (X[j]-i) ** 2
    ans = min(ans,temp)
print(ans)