import sys
input = sys.stdin.readline

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

def I(): return int(input())
def MI(): return 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()
