import sys
N = int(input())
X = [int(c) for c in input().split()]
l = [10**10]
for i in range(1,101):
    l.append(0)
    for j in range(len(X)):
        l[i] += (X[j]-i)**2
    
    if l[i-1] < l[i]:
        print(l[i-1])
        sys.exit(0) import sys sys N = int(input()) N int(input()) int input() input int(c) for c in input().split() for c in input().split() c input().split() ().split () input split for c in input().split() int(c) int c X = [int(c) for c in input().split()] X [int(c) for c in input().split()] l = [10**10] l [10**10] 10**10 10 10 for i in range(1,101):
    l.append(0)
    for j in range(len(X)):
        l[i] += (X[j]-i)**2
    
    if l[i-1] < l[i]:
        print(l[i-1])
        sys.exit(0) i range(1,101) range 1 101 l.append(0) l.append l append 0 for j in range(len(X)):
        l[i] += (X[j]-i)**2
    
     j range(len(X)) range len(X) len X l[i] += (X[j]-i)**2 l[i] l i (X[j]-i)**2 X[j]-i X[j] X j i 2 if l[i-1] < l[i]:
        print(l[i-1])
        sys.exit(0) l[i-1] < l[i] l[i-1] l i-1 i 1 l[i] l i print(l[i-1]) print l[i-1] l i-1 i 1 sys.exit(0) sys.exit sys exit 0 N = int(input()) int(input()) N l = [10**10] [10**10] l X = [int(c) for c in input().split()] [int(c) for c in input().split()] X
import sys
N = int(input())
X = [int(c) for c in input().split()]
l = [10**10]
for i in range(1,101):
    l.append(0)
    for j in range(len(X)):
        l[i] += (X[j]-i)**2
    
    if l[i-1] < l[i]:
        print(l[i-1])
        sys.exit(0)