import sys, bisect, math, itertools, string, queue, copy
import numpy as np
import scipy
from collections import Counter,defaultdict,deque
from itertools import permutations, combinations
from heapq import heappop, heappush
from fractions import gcd
input = sys.stdin.readline
sys.setrecursionlimit(10**8)
mod = 10**9+7
def inp(): return int(input())
def inpm(): return map(int,input().split())
def inpl(): return list(map(int, input().split()))
def inpls(): return list(input().split())
def inplm(n): return list(int(input()) for _ in range(n))
def inplL(n): return [list(input()) for _ in range(n)]
def inplT(n): return [tuple(input()) for _ in range(n)]
def inpll(n): return [list(map(int, input().split())) for _ in range(n)]
def inplls(n): return sorted([list(map(int, input().split())) for _ in range(n)])

n = inp()
x = sorted(inpl())

ans = 10**100
for p in range(1,101):
    s = 0
    for i in range(n):
        s += (x[i] - p)**2
    ans = min(ans,s)

print(ans) import sys, bisect, math, itertools, string, queue, copy sys bisect math itertools string queue copy import numpy as np numpy import scipy scipy from collections import Counter,defaultdict,deque from itertools import permutations, combinations from heapq import heappop, heappush from fractions import gcd input = sys.stdin.readline input sys.stdin.readline sys.stdin sys stdin readline sys.setrecursionlimit(10**8) sys.setrecursionlimit sys setrecursionlimit 10**8 10 8 mod = 10**9+7 mod 10**9+7 10**9 10 9 7 def inp(): return int(input()) inp def inpm(): return map(int,input().split()) inpm def inpl(): return list(map(int, input().split())) inpl def inpls(): return list(input().split()) inpls def inplm(n): return list(int(input()) for _ in range(n)) inplm n n list(input()) for _ in range(n) for _ in range(n) _ range(n) range n for _ in range(n) list(input()) list input() input def inplL(n): return [list(input()) for _ in range(n)] inplL n n tuple(input()) for _ in range(n) for _ in range(n) _ range(n) range n for _ in range(n) tuple(input()) tuple input() input def inplT(n): return [tuple(input()) for _ in range(n)] inplT n n list(map(int, input().split())) for _ in range(n) for _ in range(n) _ range(n) range n for _ in range(n) list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split def inpll(n): return [list(map(int, input().split())) for _ in range(n)] inpll n n list(map(int, input().split())) for _ in range(n) for _ in range(n) _ range(n) range n for _ in range(n) list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split def inplls(n): return sorted([list(map(int, input().split())) for _ in range(n)]) inplls n n n = inp() n inp() inp x = sorted(inpl()) x sorted(inpl()) sorted inpl() inpl ans = 10**100 ans 10**100 10 100 for p in range(1,101):
    s = 0
    for i in range(n):
        s += (x[i] - p)**2
    ans = min(ans,s) p range(1,101) range 1 101 s = 0 s 0 for i in range(n):
        s += (x[i] - p)**2
     i range(n) range n s += (x[i] - p)**2 s (x[i] - p)**2 x[i] - p x[i] x i p 2 ans = min(ans,s) ans min(ans,s) min ans s print(ans) print ans def inp(): return int(input()) def inp(): return int(input()) inp input = sys.stdin.readline sys.stdin.readline input s = 0 0 s def inplT(n): return [tuple(input()) for _ in range(n)] def inplT(n): return [tuple(input()) for _ in range(n)] inplT def inplL(n): return [list(input()) for _ in range(n)] def inplL(n): return [list(input()) for _ in range(n)] inplL def inpls(): return list(input().split()) def inpls(): return list(input().split()) inpls mod = 10**9+7 10**9+7 mod n = inp() inp() n def inpl(): return list(map(int, input().split())) def inpl(): return list(map(int, input().split())) inpl def inpll(n): return [list(map(int, input().split())) for _ in range(n)] def inpll(n): return [list(map(int, input().split())) for _ in range(n)] inpll s += (x[i] - p)**2 (x[i] - p)**2 s ans = min(ans,s) min(ans,s) ans def inplls(n): return sorted([list(map(int, input().split())) for _ in range(n)]) def inplls(n): return sorted([list(map(int, input().split())) for _ in range(n)]) inplls def inpm(): return map(int,input().split()) def inpm(): return map(int,input().split()) inpm def inplm(n): return list(int(input()) for _ in range(n)) def inplm(n): return list(int(input()) for _ in range(n)) inplm ans = 10**100 10**100 ans x = sorted(inpl()) sorted(inpl()) x
import sys, bisect, math, itertools, string, queue, copy
import numpy as np
import scipy
from collections import Counter,defaultdict,deque
from itertools import permutations, combinations
from heapq import heappop, heappush
from fractions import gcd
input = sys.stdin.readline
sys.setrecursionlimit(10**8)
mod = 10**9+7
def inp(): return int(input())
def inpm(): return map(int,input().split())
def inpl(): return list(map(int, input().split()))
def inpls(): return list(input().split())
def inplm(n): return list(int(input()) for _ in range(n))
def inplL(n): return [list(input()) for _ in range(n)]
def inplT(n): return [tuple(input()) for _ in range(n)]
def inpll(n): return [list(map(int, input().split())) for _ in range(n)]
def inplls(n): return sorted([list(map(int, input().split())) for _ in range(n)])

n = inp()
x = sorted(inpl())

ans = 10**100
for p in range(1,101):
    s = 0
    for i in range(n):
        s += (x[i] - p)**2
    ans = min(ans,s)

print(ans)