import bisect, collections, copy, heapq, itertools, math, string
import sys
def I(): return int(sys.stdin.readline().rstrip())
def MI(): return map(int, sys.stdin.readline().rstrip().split())
def LI(): return list(map(int, sys.stdin.readline().rstrip().split()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())

from  collections import defaultdict
import bisect
def main():
    N = I()
    X = LI()
    Ans_list = []
    for i in range(1, 101):
        cnt = 0
        for x in X:
            cnt += (x - i) ** 2
        Ans_list.append(cnt)
    print(min(Ans_list))

if __name__ == "__main__":
    main() import bisect, collections, copy, heapq, itertools, math, string bisect collections copy heapq itertools math string import sys sys def I(): return int(sys.stdin.readline().rstrip()) I def MI(): return map(int, sys.stdin.readline().rstrip().split()) MI def LI(): return list(map(int, sys.stdin.readline().rstrip().split())) LI def S(): return sys.stdin.readline().rstrip() S def LS(): return list(sys.stdin.readline().rstrip().split()) LS from  collections import defaultdict import bisect bisect def main():
    N = I()
    X = LI()
    Ans_list = []
    for i in range(1, 101):
        cnt = 0
        for x in X:
            cnt += (x - i) ** 2
        Ans_list.append(cnt)
    print(min(Ans_list)) main N = I() N I() I X = LI() X LI() LI Ans_list = [] Ans_list [] for i in range(1, 101):
        cnt = 0
        for x in X:
            cnt += (x - i) ** 2
        Ans_list.append(cnt)
     i range(1, 101) range 1 101 cnt = 0 cnt 0 for x in X:
            cnt += (x - i) ** 2
         x X cnt += (x - i) ** 2 cnt (x - i) ** 2 x - i x i 2 Ans_list.append(cnt) Ans_list.append Ans_list append cnt print(min(Ans_list)) print min(Ans_list) min Ans_list if __name__ == "__main__":
    main() __name__ == "__main__" __name__ "__main__" main() main def S(): return sys.stdin.readline().rstrip() def S(): return sys.stdin.readline().rstrip() S def MI(): return map(int, sys.stdin.readline().rstrip().split()) def MI(): return map(int, sys.stdin.readline().rstrip().split()) MI def LI(): return list(map(int, sys.stdin.readline().rstrip().split())) def LI(): return list(map(int, sys.stdin.readline().rstrip().split())) LI def I(): return int(sys.stdin.readline().rstrip()) def I(): return int(sys.stdin.readline().rstrip()) I def LS(): return list(sys.stdin.readline().rstrip().split()) def LS(): return list(sys.stdin.readline().rstrip().split()) LS def main():
    N = I()
    X = LI()
    Ans_list = []
    for i in range(1, 101):
        cnt = 0
        for x in X:
            cnt += (x - i) ** 2
        Ans_list.append(cnt)
    print(min(Ans_list)) def main():
    N = I()
    X = LI()
    Ans_list = []
    for i in range(1, 101):
        cnt = 0
        for x in X:
            cnt += (x - i) ** 2
        Ans_list.append(cnt)
    print(min(Ans_list)) main
import bisect, collections, copy, heapq, itertools, math, string
import sys
def I(): return int(sys.stdin.readline().rstrip())
def MI(): return map(int, sys.stdin.readline().rstrip().split())
def LI(): return list(map(int, sys.stdin.readline().rstrip().split()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())

from  collections import defaultdict
import bisect
def main():
    N = I()
    X = LI()
    Ans_list = []
    for i in range(1, 101):
        cnt = 0
        for x in X:
            cnt += (x - i) ** 2
        Ans_list.append(cnt)
    print(min(Ans_list))

if __name__ == "__main__":
    main()
