n=int(eval(input()))

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



ans=float("inf")

for i in range(1,101):

  ans=min(ans,sum([(c-i)**2 for c in l]))

print(ans)
import sys

input=sys.stdin.readline

n=int(eval(input()))

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

d=sum(l)//n

def dis(x):

    global l;ret=0

    for i in l:

        ret+=(x-i)**2



    return ret

print((min(dis(d),dis(d+1))))
n = int(eval(input()))
l = list(map(int, input().split()))
ans = float("inf")
for i in range(1, 101):
    ans = min(ans, sum([(c - i) ** 2 for c in l]))
print(ans)

import sys

input = sys.stdin.readline
n = int(eval(input()))
l = list(map(int, input().split()))
d = sum(l) // n


def dis(x):
    global l
    ret = 0
    for i in l:
        ret += (x - i) ** 2
    return ret


print((min(dis(d), dis(d + 1))))

+import sys + +input = sys.stdin.readline -ans = float("inf") -for i in range(1, 101): -    ans = min(ans, sum([(c - i) ** 2 for c in l])) -print(ans) +d = sum(l) // n + + +def dis(x): +    global l +    ret = 0 +    for i in l: +        ret += (x - i) ** 2 +    return ret + + +print((min(dis(d), dis(d + 1))))