Instead of feeding the mains to the pic pin, drive an opto like the PC814.

This has 2 LEDs in anti-parallel at the input, so you'd get 2 pulses for each mains cycle, one each for positive and negative. This will also give you a bonus of isolating your circuit from the mains.

Regards,

Anand Dhuru