#!/usr/bin/env python3
from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
from functools import lru_cache
import sys
sys.setrecursionlimit(10000)
INF = float("inf")
YES, Yes, yes, NO, No, no = "YES", "Yes", "yes", "NO", "No", "no"
dy4, dx4 = [0, 1, 0, -1], [1, 0, -1, 0]
dy8, dx8 = [0, -1, 0, 1, 1, -1, -1, 1], [1, 0, -1, 0, 1, 1, -1, -1]


def inside(y, x, H, W):
    return 0 <= y < H and 0 <= x < W


def ceil(a, b):
    return (a + b - 1) // b


def sum_of_arithmetic_progression(s, d, n):
    return n * (2 * s + (n - 1) * d) // 2


def gcd(a, b):
    if b == 0:
        return a
    return gcd(b, a % b)


def lcm(a, b):
    g = gcd(a, b)
    return a / g * b


def solve():
    N = int(input())
    X = list(map(int, input().split()))

    ans = INF
    for p in range(0, 102):
        t = 0
        for x in X:
            t += (x - p) ** 2
        ans = min(ans, t)
    print(ans)

def main():
    solve()


if __name__ == '__main__':
    main() from collections import defaultdict, Counter from itertools import product, groupby, count, permutations, combinations from math import pi, sqrt from collections import deque from bisect import bisect, bisect_left, bisect_right from string import ascii_lowercase from functools import lru_cache import sys sys sys.setrecursionlimit(10000) sys.setrecursionlimit sys setrecursionlimit 10000 INF = float("inf") INF float("inf") float "inf" YES, Yes, yes, NO, No, no = "YES", "Yes", "yes", "NO", "No", "no" YES "YES" Yes "Yes" yes "yes" NO "NO" No "No" no "no" dy4, dx4 = [0, 1, 0, -1], [1, 0, -1, 0] dy4 [0, 1, 0, -1] 0 1 0 -1 dx4 [1, 0, -1, 0] 1 0 -1 0 dy8, dx8 = [0, -1, 0, 1, 1, -1, -1, 1], [1, 0, -1, 0, 1, 1, -1, -1] dy8 [0, -1, 0, 1, 1, -1, -1, 1] 0 -1 0 1 1 -1 -1 1 dx8 [1, 0, -1, 0, 1, 1, -1, -1] 1 0 -1 0 1 1 -1 -1 def inside(y, x, H, W):
    return 0 <= y < H and 0 <= x < W inside return 0 <= y < H and 0 <= x < W 0 <= y < H and 0 <= x < W 0 <= y < H 0 <= y 0 y H 0 <= x < W 0 <= x 0 x W y y x x H H W W def ceil(a, b):
    return (a + b - 1) // b ceil return (a + b - 1) // b (a + b - 1) // b a + b - 1 a + b a b 1 b a a b b def sum_of_arithmetic_progression(s, d, n):
    return n * (2 * s + (n - 1) * d) // 2 sum_of_arithmetic_progression return n * (2 * s + (n - 1) * d) // 2 n * (2 * s + (n - 1) * d) // 2 n * (2 * s + (n - 1) * d) n 2 * s + (n - 1) * d 2 * s 2 s (n - 1) * d n - 1 n 1 d 2 s s d d n n def gcd(a, b):
    if b == 0:
        return a
    return gcd(b, a % b) gcd if b == 0:
        return a
     b == 0 b 0 return a a return gcd(b, a % b) gcd(b, a % b) gcd b a % b a b a a b b def lcm(a, b):
    g = gcd(a, b)
    return a / g * b lcm g = gcd(a, b) g gcd(a, b) gcd a b return a / g * b a / g * b a / g a g b a a b b def solve():
    N = int(input())
    X = list(map(int, input().split()))

    ans = INF
    for p in range(0, 102):
        t = 0
        for x in X:
            t += (x - p) ** 2
        ans = min(ans, t)
    print(ans) solve N = int(input()) N int(input()) int input() input X = list(map(int, input().split())) X list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split ans = INF ans INF for p in range(0, 102):
        t = 0
        for x in X:
            t += (x - p) ** 2
        ans = min(ans, t)
     p range(0, 102) range 0 102 t = 0 t 0 for x in X:
            t += (x - p) ** 2
         x X t += (x - p) ** 2 t (x - p) ** 2 x - p x p 2 ans = min(ans, t) ans min(ans, t) min ans t print(ans) print ans def main():
    solve() main solve() solve if __name__ == '__main__':
    main() __name__ == '__main__' __name__ '__main__' main() main yes, NO, No, no = "YES", "Yes", "yes", "NO", "No", "no" "yes" yes No, no = "YES", "Yes", "yes", "NO", "No", "no" "No" No def solve():
    N = int(input())
    X = list(map(int, input().split()))

    ans = INF
    for p in range(0, 102):
        t = 0
        for x in X:
            t += (x - p) ** 2
        ans = min(ans, t)
    print(ans) def solve():
    N = int(input())
    X = list(map(int, input().split()))

    ans = INF
    for p in range(0, 102):
        t = 0
        for x in X:
            t += (x - p) ** 2
        ans = min(ans, t)
    print(ans) solve NO, No, no = "YES", "Yes", "yes", "NO", "No", "no" "NO" NO dx8 = [0, -1, 0, 1, 1, -1, -1, 1], [1, 0, -1, 0, 1, 1, -1, -1] [1, 0, -1, 0, 1, 1, -1, -1] dx8 def inside(y, x, H, W):
    return 0 <= y < H and 0 <= x < W def inside(y, x, H, W):
    return 0 <= y < H and 0 <= x < W inside def main():
    solve() def main():
    solve() main dy4, dx4 = [0, 1, 0, -1], [1, 0, -1, 0] [0, 1, 0, -1] dy4 Yes, yes, NO, No, no = "YES", "Yes", "yes", "NO", "No", "no" "Yes" Yes def gcd(a, b):
    if b == 0:
        return a
    return gcd(b, a % b) def gcd(a, b):
    if b == 0:
        return a
    return gcd(b, a % b) gcd def lcm(a, b):
    g = gcd(a, b)
    return a / g * b def lcm(a, b):
    g = gcd(a, b)
    return a / g * b lcm INF = float("inf") float("inf") INF YES, Yes, yes, NO, No, no = "YES", "Yes", "yes", "NO", "No", "no" "YES" YES no = "YES", "Yes", "yes", "NO", "No", "no" "no" no dx4 = [0, 1, 0, -1], [1, 0, -1, 0] [1, 0, -1, 0] dx4 dy8, dx8 = [0, -1, 0, 1, 1, -1, -1, 1], [1, 0, -1, 0, 1, 1, -1, -1] [0, -1, 0, 1, 1, -1, -1, 1] dy8 def sum_of_arithmetic_progression(s, d, n):
    return n * (2 * s + (n - 1) * d) // 2 def sum_of_arithmetic_progression(s, d, n):
    return n * (2 * s + (n - 1) * d) // 2 sum_of_arithmetic_progression def ceil(a, b):
    return (a + b - 1) // b def ceil(a, b):
    return (a + b - 1) // b ceil
#!/usr/bin/env python3
from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
from functools import lru_cache
import sys
sys.setrecursionlimit(10000)
INF = float("inf")
YES, Yes, yes, NO, No, no = "YES", "Yes", "yes", "NO", "No", "no"
dy4, dx4 = [0, 1, 0, -1], [1, 0, -1, 0]
dy8, dx8 = [0, -1, 0, 1, 1, -1, -1, 1], [1, 0, -1, 0, 1, 1, -1, -1]


def inside(y, x, H, W):
    return 0 <= y < H and 0 <= x < W


def ceil(a, b):
    return (a + b - 1) // b


def sum_of_arithmetic_progression(s, d, n):
    return n * (2 * s + (n - 1) * d) // 2


def gcd(a, b):
    if b == 0:
        return a
    return gcd(b, a % b)


def lcm(a, b):
    g = gcd(a, b)
    return a / g * b


def solve():
    N = int(input())
    X = list(map(int, input().split()))

    ans = INF
    for p in range(0, 102):
        t = 0
        for x in X:
            t += (x - p) ** 2
        ans = min(ans, t)
    print(ans)

def main():
    solve()


if __name__ == '__main__':
    main()
