import sys

def main():

    N = int(sys.stdin.readline().rstrip())
    X = [int(x) for x in sys.stdin.readline().rstrip().split()]

    m = 100**2 * 100
    for p in range(101):
        tmp = 0
        for x in X:
            tmp += (x - p)**2
        m = min(tmp,m)

    print(m)


main() import sys sys def main():

    N = int(sys.stdin.readline().rstrip())
    X = [int(x) for x in sys.stdin.readline().rstrip().split()]

    m = 100**2 * 100
    for p in range(101):
        tmp = 0
        for x in X:
            tmp += (x - p)**2
        m = min(tmp,m)

    print(m) main N = int(sys.stdin.readline().rstrip()) N int(sys.stdin.readline().rstrip()) int sys.stdin.readline().rstrip() sys.stdin.readline().rstrip sys.stdin.readline() sys.stdin.readline sys.stdin sys stdin readline rstrip int(x) for x in sys.stdin.readline().rstrip().split() for x in sys.stdin.readline().rstrip().split() x sys.stdin.readline().rstrip().split() sys.stdin.readline().rstrip().split sys.stdin.readline().rstrip() sys.stdin.readline().rstrip sys.stdin.readline() sys.stdin.readline sys.stdin sys stdin readline rstrip split for x in sys.stdin.readline().rstrip().split() int(x) int x X = [int(x) for x in sys.stdin.readline().rstrip().split()] X [int(x) for x in sys.stdin.readline().rstrip().split()] m = 100**2 * 100 m 100**2 * 100 100**2 100 2 100 for p in range(101):
        tmp = 0
        for x in X:
            tmp += (x - p)**2
        m = min(tmp,m)

     p range(101) range 101 tmp = 0 tmp 0 for x in X:
            tmp += (x - p)**2
         x X tmp += (x - p)**2 tmp (x - p)**2 x - p x p 2 m = min(tmp,m) m min(tmp,m) min tmp m print(m) print m main() main def main():

    N = int(sys.stdin.readline().rstrip())
    X = [int(x) for x in sys.stdin.readline().rstrip().split()]

    m = 100**2 * 100
    for p in range(101):
        tmp = 0
        for x in X:
            tmp += (x - p)**2
        m = min(tmp,m)

    print(m) def main():

    N = int(sys.stdin.readline().rstrip())
    X = [int(x) for x in sys.stdin.readline().rstrip().split()]

    m = 100**2 * 100
    for p in range(101):
        tmp = 0
        for x in X:
            tmp += (x - p)**2
        m = min(tmp,m)

    print(m) main
import sys

def main():

    N = int(sys.stdin.readline().rstrip())
    X = [int(x) for x in sys.stdin.readline().rstrip().split()]

    m = 100**2 * 100
    for p in range(101):
        tmp = 0
        for x in X:
            tmp += (x - p)**2
        m = min(tmp,m)

    print(m)


main()