(defun main (&rest argv) (declare (ignorable argv)) (let* ((n (read)) (a (make-array n)) (res 0)) (dotimes (i n) (setf (aref a i) (read))) (sort a #'<) (let* ((b (aref a (1- n))) (dp (make-array (1+ b) :initial-element 0))) (dotimes (i n) (let ((c (aref a i))) (setf (aref dp c) (max 1 (aref dp c))) (loop for j from (* 2 c) to b by c do (setf (aref dp j) (max (aref dp j) (1+ (aref dp c))))))) (dotimes (i n) (setq res (max res (aref dp (aref a i)))))) (format t "~d~%" res))) (main)