you could try using the "change on portb" interrupt. put both of the inputs on port b and then any change will trigger the interrupt. You could set up the interrupt handler to figure out which one has changed and using a timer and a bit of maths, work out both frequencies.