This question has already been done to death.
https://web2.0calc.com/questions/counting-problem_8
You can continue the discussion on the original thread if you want to.
Continue on the original thread BUT you can put a link here saying you have done so. (Otherwise, your addition is likely to be overlooked)