Charlieplexing is a multiplexing technique allowing to control N \$\times\$ (N-1) LEDs or buttons with N I/Os.

Further reading
Charlieplexing explained at pcbheaven