import sys
read = sys.stdin.read
readlines = sys.stdin.readlines
import numpy as np
def main():
    n = int(input())
    p = np.array(read().split(), np.int32)
    r = float('inf')
    for i1 in range(101):
        r = min(r, sum((p - i1)**2))
    print(r)

if __name__ == '__main__':
    main() import sys sys read = sys.stdin.read read sys.stdin.read sys.stdin sys stdin read readlines = sys.stdin.readlines readlines sys.stdin.readlines sys.stdin sys stdin readlines import numpy as np numpy def main():
    n = int(input())
    p = np.array(read().split(), np.int32)
    r = float('inf')
    for i1 in range(101):
        r = min(r, sum((p - i1)**2))
    print(r) main n = int(input()) n int(input()) int input() input p = np.array(read().split(), np.int32) p np.array(read().split(), np.int32) np.array np array read().split() ().split () read split np.int32 np int32 r = float('inf') r float('inf') float 'inf' for i1 in range(101):
        r = min(r, sum((p - i1)**2))
     i1 range(101) range 101 r = min(r, sum((p - i1)**2)) r min(r, sum((p - i1)**2)) min r sum((p - i1)**2) sum (p - i1)**2 p - i1 p i1 2 print(r) print r if __name__ == '__main__':
    main() __name__ == '__main__' __name__ '__main__' main() main read = sys.stdin.read sys.stdin.read read readlines = sys.stdin.readlines sys.stdin.readlines readlines def main():
    n = int(input())
    p = np.array(read().split(), np.int32)
    r = float('inf')
    for i1 in range(101):
        r = min(r, sum((p - i1)**2))
    print(r) def main():
    n = int(input())
    p = np.array(read().split(), np.int32)
    r = float('inf')
    for i1 in range(101):
        r = min(r, sum((p - i1)**2))
    print(r) main
import sys
read = sys.stdin.read
readlines = sys.stdin.readlines
import numpy as np
def main():
    n = int(input())
    p = np.array(read().split(), np.int32)
    r = float('inf')
    for i1 in range(101):
        r = min(r, sum((p - i1)**2))
    print(r)

if __name__ == '__main__':
    main()