import bisect, copy, heapq, math, sys
from collections import *
from functools import lru_cache
from itertools import accumulate, combinations, permutations, product
def input():
    return sys.stdin.readline()[:-1]
def ruiseki(lst):
    return [0]+list(accumulate(lst))
def celi(a,b):
    return -(-a//b)
sys.setrecursionlimit(5000000)
mod=pow(10,9)+7
al=[chr(ord('a') + i) for i in range(26)]
direction=[[1,0],[0,1],[-1,0],[0,-1]]

n=int(input())
x=list(map(int,input().split()))

ans=float('inf')
for i in range(100):
    tmp=0
    for j in range(n):
        tmp+=(x[j]-i-1)**2
    ans=min(ans,tmp)
print(ans) import bisect, copy, heapq, math, sys bisect copy heapq math sys from collections import * from functools import lru_cache from itertools import accumulate, combinations, permutations, product def input():
    return sys.stdin.readline()[:-1] input return sys.stdin.readline()[:-1] sys.stdin.readline()[:-1] sys.stdin.readline() sys.stdin.readline sys.stdin sys stdin readline :-1 -1 def ruiseki(lst):
    return [0]+list(accumulate(lst)) ruiseki return [0]+list(accumulate(lst)) [0]+list(accumulate(lst)) [0] 0 list(accumulate(lst)) list accumulate(lst) accumulate lst lst lst def celi(a,b):
    return -(-a//b) celi return -(-a//b) -(-a//b) -a//b -a a b a a b b sys.setrecursionlimit(5000000) sys.setrecursionlimit sys setrecursionlimit 5000000 mod=pow(10,9)+7 mod pow(10,9)+7 pow(10,9) pow 10 9 7 chr(ord('a') + i) for i in range(26) for i in range(26) i range(26) range 26 for i in range(26) chr(ord('a') + i) chr ord('a') + i ord('a') ord 'a' i al=[chr(ord('a') + i) for i in range(26)] al [chr(ord('a') + i) for i in range(26)] direction=[[1,0],[0,1],[-1,0],[0,-1]] direction [[1,0],[0,1],[-1,0],[0,-1]] [1,0] 1 0 [0,1] 0 1 [-1,0] -1 0 [0,-1] 0 -1 n=int(input()) n int(input()) int input() input x=list(map(int,input().split())) x list(map(int,input().split())) list map(int,input().split()) map int input().split() ().split () input split ans=float('inf') ans float('inf') float 'inf' for i in range(100):
    tmp=0
    for j in range(n):
        tmp+=(x[j]-i-1)**2
    ans=min(ans,tmp) i range(100) range 100 tmp=0 tmp 0 for j in range(n):
        tmp+=(x[j]-i-1)**2
     j range(n) range n tmp+=(x[j]-i-1)**2 tmp (x[j]-i-1)**2 x[j]-i-1 x[j]-i x[j] x j i 1 2 ans=min(ans,tmp) ans min(ans,tmp) min ans tmp print(ans) print ans def ruiseki(lst):
    return [0]+list(accumulate(lst)) def ruiseki(lst):
    return [0]+list(accumulate(lst)) ruiseki mod=pow(10,9)+7 pow(10,9)+7 mod direction=[[1,0],[0,1],[-1,0],[0,-1]] [[1,0],[0,1],[-1,0],[0,-1]] direction al=[chr(ord('a') + i) for i in range(26)] [chr(ord('a') + i) for i in range(26)] al def celi(a,b):
    return -(-a//b) def celi(a,b):
    return -(-a//b) celi n=int(input()) int(input()) n x=list(map(int,input().split())) list(map(int,input().split())) x tmp=0 0 tmp def input():
    return sys.stdin.readline()[:-1] def input():
    return sys.stdin.readline()[:-1] input ans=float('inf') float('inf') ans ans=min(ans,tmp) min(ans,tmp) ans tmp+=(x[j]-i-1)**2 (x[j]-i-1)**2 tmp
import bisect, copy, heapq, math, sys
from collections import *
from functools import lru_cache
from itertools import accumulate, combinations, permutations, product
def input():
    return sys.stdin.readline()[:-1]
def ruiseki(lst):
    return [0]+list(accumulate(lst))
def celi(a,b):
    return -(-a//b)
sys.setrecursionlimit(5000000)
mod=pow(10,9)+7
al=[chr(ord('a') + i) for i in range(26)]
direction=[[1,0],[0,1],[-1,0],[0,-1]]

n=int(input())
x=list(map(int,input().split()))

ans=float('inf')
for i in range(100):
    tmp=0
    for j in range(n):
        tmp+=(x[j]-i-1)**2
    ans=min(ans,tmp)
print(ans)