def main():

    n = int(eval(input()))

    *xs, = list(map(int, input().split()))



    ret = float('inf')

    for p in range(100 + 1):

        t = 0

        for x in xs:

            t += (p - x) ** 2

        ret = min(ret, t)

    print(ret)





if __name__ == '__main__':

    main()



# import sys

#

# sys.setrecursionlimit(10 ** 7)

#

# input = sys.stdin.readline

# rstrip()

# int(input())

# map(int, input().split())

n = int(eval(input()))

xs = tuple(map(int, input().split()))



ret = min(

    sum(

        (x - p) * (x - p)

        for x in xs

    ) for p in range(1, 100 + 1)

)



print(ret)

def main():
    n = int(eval(input()))
    (*xs,) = list(map(int, input().split()))
    ret = float("inf")
    for p in range(100 + 1):
        t = 0
        for x in xs:
            t += (p - x) ** 2
        ret = min(ret, t)
    print(ret)


if __name__ == "__main__":
    main()
# import sys
#
# sys.setrecursionlimit(10 ** 7)
#
# input = sys.stdin.readline
# rstrip()
# int(input())
# map(int, input().split())

n = int(eval(input()))
xs = tuple(map(int, input().split()))
ret = min(sum((x - p) * (x - p) for x in xs) for p in range(1, 100 + 1))
print(ret)

-def main(): -    n = int(eval(input())) -    (*xs,) = list(map(int, input().split())) -    ret = float("inf") -    for p in range(100 + 1): -        t = 0 -        for x in xs: -            t += (p - x) ** 2 -        ret = min(ret, t) -    print(ret) - - -if __name__ == "__main__": -    main() -# import sys -# -# sys.setrecursionlimit(10 ** 7) -# -# input = sys.stdin.readline -# rstrip() -# int(input()) -# map(int, input().split()) +n = int(eval(input())) +xs = tuple(map(int, input().split())) +ret = min(sum((x - p) * (x - p) for x in xs) for p in range(1, 100 + 1)) +print(ret)