# -*- coding:utf-8 -*-
n = int(input())

PosList = []
TempSum = 0
ReturnSum = 0

PosList = list(map(int,input().split()))


for pos in range(1,101):
    TempSum = 0
    for nPos in range(n):
        TempSum += (pos - PosList[nPos])**2
    if pos == 1:
        ReturnSum = TempSum
    elif ReturnSum > TempSum:
        ReturnSum = TempSum
    """
    print("Position = "+str(pos))
    print("TempSum = "+ str(TempSum))
    print("ReturnSum = " + str(ReturnSum))
    print("----------------------------")
    """

print(ReturnSum) n = int(input()) n int(input()) int input() input PosList = [] PosList [] TempSum = 0 TempSum 0 ReturnSum = 0 ReturnSum 0 PosList = list(map(int,input().split())) PosList list(map(int,input().split())) list map(int,input().split()) map int input().split() ().split () input split for pos in range(1,101):
    TempSum = 0
    for nPos in range(n):
        TempSum += (pos - PosList[nPos])**2
    if pos == 1:
        ReturnSum = TempSum
    elif ReturnSum > TempSum:
        ReturnSum = TempSum
    """
    print("Position = "+str(pos))
    print("TempSum = "+ str(TempSum))
    print("ReturnSum = " + str(ReturnSum))
    print("----------------------------")
    """ pos range(1,101) range 1 101 TempSum = 0 TempSum 0 for nPos in range(n):
        TempSum += (pos - PosList[nPos])**2
     nPos range(n) range n TempSum += (pos - PosList[nPos])**2 TempSum (pos - PosList[nPos])**2 pos - PosList[nPos] pos PosList[nPos] PosList nPos 2 if pos == 1:
        ReturnSum = TempSum
    elif ReturnSum > TempSum:
        ReturnSum = TempSum
     pos == 1 pos 1 ReturnSum = TempSum ReturnSum TempSum elif ReturnSum > TempSum:
        ReturnSum = TempSum
     ReturnSum > TempSum ReturnSum TempSum ReturnSum = TempSum ReturnSum TempSum """
    print("Position = "+str(pos))
    print("TempSum = "+ str(TempSum))
    print("ReturnSum = " + str(ReturnSum))
    print("----------------------------")
    """ print(ReturnSum) print ReturnSum ReturnSum = TempSum TempSum ReturnSum ReturnSum = TempSum TempSum ReturnSum n = int(input()) int(input()) n TempSum = 0 0 TempSum ReturnSum = 0 0 ReturnSum PosList = list(map(int,input().split())) list(map(int,input().split())) PosList PosList = [] [] PosList TempSum += (pos - PosList[nPos])**2 (pos - PosList[nPos])**2 TempSum TempSum = 0 0 TempSum
# -*- coding:utf-8 -*-
n = int(input())

PosList = []
TempSum = 0
ReturnSum = 0

PosList = list(map(int,input().split()))


for pos in range(1,101):
    TempSum = 0
    for nPos in range(n):
        TempSum += (pos - PosList[nPos])**2
    if pos == 1:
        ReturnSum = TempSum
    elif ReturnSum > TempSum:
        ReturnSum = TempSum
    """
    print("Position = "+str(pos))
    print("TempSum = "+ str(TempSum))
    print("ReturnSum = " + str(ReturnSum))
    print("----------------------------")
    """

print(ReturnSum)