import sys

import numpy as np



sr = lambda: sys.stdin.readline().rstrip()

ir = lambda: int(sr())

lr = lambda: list(map(int, sr().split()))



N = ir()

X = np.array(lr())



def F(z):

    return ((X-z) ** 2).sum()

left = 0

right = 100

while right > left + 1:

    left_mid = (2*left + right) / 3

    right_mid = (left + 2*right) / 3

    if F(left_mid) < F(right_mid):

        right = right_mid

    else:

        left = left_mid



answer = min(F(int(left)), F(int(left)+1), F(int(left)+2))

print(answer)

# coding: utf-8

import sys

import numpy as np



sr = lambda: sys.stdin.readline().rstrip()

ir = lambda: int(sr())

lr = lambda: list(map(int, sr().split()))



N = ir()

X = np.array(lr())

# Brute Force Attack

answer = 10 ** 6

for x in range(101):

    temp = ((X-x) ** 2).sum()

    if temp < answer:

        answer = temp



print(answer)

import sys
import numpy as np

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
N = ir()
X = np.array(lr())


def F(z):
    return ((X - z) ** 2).sum()


left = 0
right = 100
while right > left + 1:
    left_mid = (2 * left + right) / 3
    right_mid = (left + 2 * right) / 3
    if F(left_mid) < F(right_mid):
        right = right_mid
    else:
        left = left_mid
answer = min(F(int(left)), F(int(left) + 1), F(int(left) + 2))
print(answer)

# coding: utf-8
import sys
import numpy as np

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
N = ir()
X = np.array(lr())
# Brute Force Attack
answer = 10**6
for x in range(101):
    temp = ((X - x) ** 2).sum()
    if temp < answer:
        answer = temp
print(answer)

+# coding: utf-8 - - -def F(z): -    return ((X - z) ** 2).sum() - - -left = 0 -right = 100 -while right > left + 1: -    left_mid = (2 * left + right) / 3 -    right_mid = (left + 2 * right) / 3 -    if F(left_mid) < F(right_mid): -        right = right_mid -    else: -        left = left_mid -answer = min(F(int(left)), F(int(left) + 1), F(int(left) + 2)) +# Brute Force Attack +answer = 10**6 +for x in range(101): +    temp = ((X - x) ** 2).sum() +    if temp < answer: +        answer = temp