n = input()
s = list(map(int,input().split()))
m = 10000000
for p in range(0,101):
  t = 0
  for x in s:
    t+=(x-p)**2
  m = min(t,m)
print(m) n = input() n input() input s = list(map(int,input().split())) s list(map(int,input().split())) list map(int,input().split()) map int input().split() ().split () input split m = 10000000 m 10000000 for p in range(0,101):
  t = 0
  for x in s:
    t+=(x-p)**2
  m = min(t,m) p range(0,101) range 0 101 t = 0 t 0 for x in s:
    t+=(x-p)**2
   x s t+=(x-p)**2 t (x-p)**2 x-p x p 2 m = min(t,m) m min(t,m) min t m print(m) print m m = 10000000 10000000 m t = 0 0 t t+=(x-p)**2 (x-p)**2 t m = min(t,m) min(t,m) m n = input() input() n s = list(map(int,input().split())) list(map(int,input().split())) s
n = input()
s = list(map(int,input().split()))
m = 10000000
for p in range(0,101):
  t = 0
  for x in s:
    t+=(x-p)**2
  m = min(t,m)
print(m)