If you are strictly interested in the number of trailing zeros in factorials $n!$, as the example in your question suggests, then consider the number of pairs of 2 and 5 in all the factors of numbers 1 through $n$. There is always a 2 to match a 5, so the number of fives gives the number of zeros. Integers divisible by 5 contribute one 5 to the total. Integers divisible by 25 contribute one additional 5, and so on. The maximum power to consider is Floor[Log[5,n]].
This method avoids time- and memory-consuming calculation of $n!$, and is about 50 times faster than IntegerExponent on my machine.
NumberOfFives[n_Integer] := Total[Floor[n/5^Range[Floor[Log[5,n]]]]]
However, the fastest method I've found to calculate the exponent of prime $p$ in $n!$ is the following:
PrimeExponent[n_Integer, p_Integer] := (n - Total[IntegerDigits[n, p]])/(p - 1)
which, on my machine, is about three times as fast as Mr. Wizard's answer:
Tr@Floor@NestWhileList[#/5` &, #/5`, # > 1 &] & @ 12345