Thanks everybody, the correct answer is 27.
PennMI - we do not want to do it manually as you might get a range like 1 to 10000 where it will not be feasible to count manually under 2 mins, so we are looking for a method to do it.
I agree with Kartikayeg's & singman's method. Thanks to all though.