def main():
    n = int(input())
    x_lst = list(map(int, input().split()))
    ans = 10 ** 12

    for p in range(1, 101):
        sum_hp = 0
        for x in x_lst:
            sum_hp += (x - p) ** 2
        if sum_hp < ans:
            ans = sum_hp

    print(ans)


if __name__ == "__main__":
    main() def main():
    n = int(input())
    x_lst = list(map(int, input().split()))
    ans = 10 ** 12

    for p in range(1, 101):
        sum_hp = 0
        for x in x_lst:
            sum_hp += (x - p) ** 2
        if sum_hp < ans:
            ans = sum_hp

    print(ans) main n = int(input()) n int(input()) int input() input x_lst = list(map(int, input().split())) x_lst list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split ans = 10 ** 12 ans 10 ** 12 10 12 for p in range(1, 101):
        sum_hp = 0
        for x in x_lst:
            sum_hp += (x - p) ** 2
        if sum_hp < ans:
            ans = sum_hp

     p range(1, 101) range 1 101 sum_hp = 0 sum_hp 0 for x in x_lst:
            sum_hp += (x - p) ** 2
         x x_lst sum_hp += (x - p) ** 2 sum_hp (x - p) ** 2 x - p x p 2 if sum_hp < ans:
            ans = sum_hp

     sum_hp < ans sum_hp ans ans = sum_hp ans sum_hp print(ans) print ans if __name__ == "__main__":
    main() __name__ == "__main__" __name__ "__main__" main() main def main():
    n = int(input())
    x_lst = list(map(int, input().split()))
    ans = 10 ** 12

    for p in range(1, 101):
        sum_hp = 0
        for x in x_lst:
            sum_hp += (x - p) ** 2
        if sum_hp < ans:
            ans = sum_hp

    print(ans) def main():
    n = int(input())
    x_lst = list(map(int, input().split()))
    ans = 10 ** 12

    for p in range(1, 101):
        sum_hp = 0
        for x in x_lst:
            sum_hp += (x - p) ** 2
        if sum_hp < ans:
            ans = sum_hp

    print(ans) main
def main():
    n = int(input())
    x_lst = list(map(int, input().split()))
    ans = 10 ** 12

    for p in range(1, 101):
        sum_hp = 0
        for x in x_lst:
            sum_hp += (x - p) ** 2
        if sum_hp < ans:
            ans = sum_hp

    print(ans)


if __name__ == "__main__":
    main()
