def stamina(x, p):
    return (x - p) ** 2


def resolve():
    N = int(input())
    Xs = list(map(int, input().split()))

    min_sum = 10 ** 10
    for p in range(1, 101):
        s_sum = 0
        for p_x in Xs:
            s_sum += stamina(p_x, p)

        min_sum = min(min_sum, s_sum)

    print(min_sum)
resolve() def stamina(x, p):
    return (x - p) ** 2 stamina return (x - p) ** 2 (x - p) ** 2 x - p x p 2 x x p p def resolve():
    N = int(input())
    Xs = list(map(int, input().split()))

    min_sum = 10 ** 10
    for p in range(1, 101):
        s_sum = 0
        for p_x in Xs:
            s_sum += stamina(p_x, p)

        min_sum = min(min_sum, s_sum)

    print(min_sum) resolve N = int(input()) N int(input()) int input() input Xs = list(map(int, input().split())) Xs list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split min_sum = 10 ** 10 min_sum 10 ** 10 10 10 for p in range(1, 101):
        s_sum = 0
        for p_x in Xs:
            s_sum += stamina(p_x, p)

        min_sum = min(min_sum, s_sum)

     p range(1, 101) range 1 101 s_sum = 0 s_sum 0 for p_x in Xs:
            s_sum += stamina(p_x, p)

         p_x Xs s_sum += stamina(p_x, p) s_sum stamina(p_x, p) stamina p_x p min_sum = min(min_sum, s_sum) min_sum min(min_sum, s_sum) min min_sum s_sum print(min_sum) print min_sum resolve() resolve def resolve():
    N = int(input())
    Xs = list(map(int, input().split()))

    min_sum = 10 ** 10
    for p in range(1, 101):
        s_sum = 0
        for p_x in Xs:
            s_sum += stamina(p_x, p)

        min_sum = min(min_sum, s_sum)

    print(min_sum) def resolve():
    N = int(input())
    Xs = list(map(int, input().split()))

    min_sum = 10 ** 10
    for p in range(1, 101):
        s_sum = 0
        for p_x in Xs:
            s_sum += stamina(p_x, p)

        min_sum = min(min_sum, s_sum)

    print(min_sum) resolve def stamina(x, p):
    return (x - p) ** 2 def stamina(x, p):
    return (x - p) ** 2 stamina
def stamina(x, p):
    return (x - p) ** 2


def resolve():
    N = int(input())
    Xs = list(map(int, input().split()))

    min_sum = 10 ** 10
    for p in range(1, 101):
        s_sum = 0
        for p_x in Xs:
            s_sum += stamina(p_x, p)

        min_sum = min(min_sum, s_sum)

    print(min_sum)
resolve()