n = int(input())
x = list(map(int,input().split()))
ans = []
if len(set(x)) == 1:
    print(0)
else: 
    for p in range(min(x), max(x)):
        meter = 0
        for xi in x:
            meter += pow((xi-p),2)
        ans.append(meter)
    print(min(ans)) 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 = [] ans [] if len(set(x)) == 1:
    print(0)
else: 
    for p in range(min(x), max(x)):
        meter = 0
        for xi in x:
            meter += pow((xi-p),2)
        ans.append(meter)
    print(min(ans)) len(set(x)) == 1 len(set(x)) len set(x) set x 1 print(0) print 0 for p in range(min(x), max(x)):
        meter = 0
        for xi in x:
            meter += pow((xi-p),2)
        ans.append(meter)
     p range(min(x), max(x)) range min(x) min x max(x) max x meter = 0 meter 0 for xi in x:
            meter += pow((xi-p),2)
         xi x meter += pow((xi-p),2) meter pow((xi-p),2) pow xi-p xi p 2 ans.append(meter) ans.append ans append meter print(min(ans)) print min(ans) min ans meter += pow((xi-p),2) pow((xi-p),2) meter n = int(input()) int(input()) n x = list(map(int,input().split())) list(map(int,input().split())) x ans = [] [] ans meter = 0 0 meter
n = int(input())
x = list(map(int,input().split()))
ans = []
if len(set(x)) == 1:
    print(0)
else: 
    for p in range(min(x), max(x)):
        meter = 0
        for xi in x:
            meter += pow((xi-p),2)
        ans.append(meter)
    print(min(ans))