multiplexing several channels
Fewer than 20 IOs can achieve this if you use latches like the 74HC573: -



If you parallel several of these (say) 16 to give up to 128 outputs you need 8 IOs to drive D0 to D7 (common to all) and 4 IO decoded to produce an extra 16 outputs to drive the individual LE lines.

Here's a design of a parallel IO card that is similar: -



It operates slightly different to how I described but, in principal produces a multitude of IO lines all controlled from a few IO lines. The clever bit about the above design is that it also uses an extra 573 for the LE lines on the 573s used to generate the wide IO range.