Creating a keyboard with a microcontroller, do I need an input pin for each key?
The idea to use a matrix is certainly the way to go. Your matrix could be organized in another way with eight input rows and four output lines for support of up to 32 switches. Since you only need to excite one input row at a time you could use a simple common 3-8 decoder to drive the input rows like shown below. This reduces the total microcontroller pin count to 7 lines!!

Note that with use of a 74HC138 type of 3-8 decoder it is necessary to flip the logic so that the output columns have pullup resistors, the diode direction is inverted and the software will see lows (0's) on the output lines where detected switches are seen.

Many thanks to tcrosley for borrowing some of his key matrix graphics and to Philips Semiconductors for the logic symbol image of their 74HC138 part.