(defun main (&rest argv) (declare (ignorable argv)) (let* ((n (read))) (when (= n 1) (format t "0~%") (return-from main)) (let* ((s (1- n)) (b (write-to-string s :base 2)) (c (count #\0 b :start 1)) (l (length b))) (format t "~d~%" (+ l c))))) (main)