n = int(input())
a = sorted(map(int, input().split()))
ans = 10000000000
for p in range(1,101):
  tmp = 0
  for j in a:
    tmp += (p-j)**2
  ans = min(tmp,ans)
print(ans) 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 ans = 10000000000 ans 10000000000 for p in range(1,101):
  tmp = 0
  for j in a:
    tmp += (p-j)**2
  ans = min(tmp,ans) p range(1,101) range 1 101 tmp = 0 tmp 0 for j in a:
    tmp += (p-j)**2
   j a tmp += (p-j)**2 tmp (p-j)**2 p-j p j 2 ans = min(tmp,ans) ans min(tmp,ans) min tmp ans print(ans) print ans tmp = 0 0 tmp tmp += (p-j)**2 (p-j)**2 tmp ans = 10000000000 10000000000 ans n = int(input()) int(input()) n a = sorted(map(int, input().split())) sorted(map(int, input().split())) a ans = min(tmp,ans) min(tmp,ans) ans
n = int(input())
a = sorted(map(int, input().split()))
ans = 10000000000
for p in range(1,101):
  tmp = 0
  for j in a:
    tmp += (p-j)**2
  ans = min(tmp,ans)
print(ans)