N=int(eval(input()))

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



ans=10**10



for i in range(100):

    p=i+1

    temp=0

    for j in range(N):

        temp+=(X[j]-p)**2

        

    ans=min(ans,temp)

    

print(ans)
import sys

input = sys.stdin.readline



def I(): return int(eval(input()))

def MI(): return list(map(int, input().split()))

def LI(): return list(map(int, input().split()))



def main():

    mod=10**9+7

    N=I()

    X=LI()

    

    ans=10**10

    

    for i in range(1,101):

        temp=0

        for j in range(N):

            temp+=abs(i-X[j])**2

        ans=min(ans,temp)

        

    print(ans)

        



main()

N = int(eval(input()))
X = list(map(int, input().split()))
ans = 10**10
for i in range(100):
    p = i + 1
    temp = 0
    for j in range(N):
        temp += (X[j] - p) ** 2
    ans = min(ans, temp)
print(ans)

import sys

input = sys.stdin.readline


def I():
    return int(eval(input()))


def MI():
    return list(map(int, input().split()))


def LI():
    return list(map(int, input().split()))


def main():
    mod = 10**9 + 7
    N = I()
    X = LI()
    ans = 10**10
    for i in range(1, 101):
        temp = 0
        for j in range(N):
            temp += abs(i - X[j]) ** 2
        ans = min(ans, temp)
    print(ans)


main()

-N = int(eval(input())) -X = list(map(int, input().split())) -ans = 10**10 -for i in range(100): -    p = i + 1 -    temp = 0 -    for j in range(N): -        temp += (X[j] - p) ** 2 -    ans = min(ans, temp) -print(ans) +import sys + +input = sys.stdin.readline + + +def I(): +    return int(eval(input())) + + +def MI(): +    return list(map(int, input().split())) + + +def LI(): +    return list(map(int, input().split())) + + +def main(): +    mod = 10**9 + 7 +    N = I() +    X = LI() +    ans = 10**10 +    for i in range(1, 101): +        temp = 0 +        for j in range(N): +            temp += abs(i - X[j]) ** 2 +        ans = min(ans, temp) +    print(ans) + + +main()