1- Set a pin as input and poll on this pin in the code and count changes or rising or falling edges.
2- Set Timer0 using an external clock and adjust the all the settings you want for the timer (prescaler , rising , falling edges or both, etc...) and use pin RA4 for counting.