you can make easily make a circuit by voltage divider method so that as soon as the key is pressed the MCU will read a voltage surge and the voltage surge mapped to the button pressed. suppose a key pad(hypothetical) with 11 keys 5/12 = 0.4167 volt per step
so 0.4167 V== "1" 0.8333== "2"........ 12.00 -0.4167=="#"
all we will need is gnd/5V and analog input pin to read voltages and off-course resistors. In this way we can accomplish task by only one pin.
You can see a schematic of a series of pushbuttons and resistors feeding a single analog input here - "http://www.dfrobot.com/image/data/DFR0009/DFR0009SCH01.pdf(resistor ladder)":http://www.dfrobot.com/image/data/DFR0009/DFR0009SCH01.pdf
The Arduino code to use them here - "http://arduinotronics.blogspot.com/2012/06/lcd-keypad-shield.html(resistor ladder code)":http://arduinotronics.blogspot.com/2012/06/lcd-keypad-shield.html