n = int(input())
a = sorted(map(int, input().split()))
ret = float('inf')
for p in range(1, 101):
    dist = 0
    for v in a:
        dist += (v - p) ** 2
    ret = min(ret, dist)
print(ret) n = int(input()) n int(input()) int input() input a = sorted(map(int, input().split())) a sorted(map(int, input().split())) sorted map(int, input().split()) map int input().split() ().split () input split ret = float('inf') ret float('inf') float 'inf' for p in range(1, 101):
    dist = 0
    for v in a:
        dist += (v - p) ** 2
    ret = min(ret, dist) p range(1, 101) range 1 101 dist = 0 dist 0 for v in a:
        dist += (v - p) ** 2
     v a dist += (v - p) ** 2 dist (v - p) ** 2 v - p v p 2 ret = min(ret, dist) ret min(ret, dist) min ret dist print(ret) print ret dist = 0 0 dist a = sorted(map(int, input().split())) sorted(map(int, input().split())) a n = int(input()) int(input()) n dist += (v - p) ** 2 (v - p) ** 2 dist ret = float('inf') float('inf') ret ret = min(ret, dist) min(ret, dist) ret
n = int(input())
a = sorted(map(int, input().split()))
ret = float('inf')
for p in range(1, 101):
    dist = 0
    for v in a:
        dist += (v - p) ** 2
    ret = min(ret, dist)
print(ret)