Minimum TTL 5.0V signal duration
It would be better to use an external counter for this task rather than trying to manage all the complexity inside the Pi to make it work and guarantee that it works. You can read the output from the counter on the GPIO pins of the Pi.