local n = io.read("*n")
local t = {}
for i = 1, n do
  t[i] = io.read("*n")
end
local ret = 1
for x = 1, 100 do
  local r = 0
  for i = 1, n do
    r = r + (t[i] - x) * (t[i] - x)
  end
  if x == 1 then ret = r
  else ret = math.min(ret, r)
  end
end
print(ret)
