N=int(eval(input()))

ls=list(map(int,input().split()))

ans=10**9+7

for i in range(1,101):

  a=0

  for j in range(N):

    a+=(i-ls[j])**2

  ans=min([ans,a])

print(ans)  
import math

N=int(eval(input()))

ls=list(map(int,input().split()))

av=math.floor(sum(ls)/N)

A=B=0

for i in range(N):

  A+=(ls[i]-av)**2

  B+=(ls[i]-av-1)**2

print((min([A,B]))) 
N = int(eval(input()))
ls = list(map(int, input().split()))
ans = 10**9 + 7
for i in range(1, 101):
    a = 0
    for j in range(N):
        a += (i - ls[j]) ** 2
    ans = min([ans, a])
print(ans)

import math

N = int(eval(input()))
ls = list(map(int, input().split()))
av = math.floor(sum(ls) / N)
A = B = 0
for i in range(N):
    A += (ls[i] - av) ** 2
    B += (ls[i] - av - 1) ** 2
print((min([A, B])))

+import math + -ans = 10**9 + 7 -for i in range(1, 101): -    a = 0 -    for j in range(N): -        a += (i - ls[j]) ** 2 -    ans = min([ans, a]) -print(ans) +av = math.floor(sum(ls) / N) +A = B = 0 +for i in range(N): +    A += (ls[i] - av) ** 2 +    B += (ls[i] - av - 1) ** 2 +print((min([A, B])))