uva1640 - The Counting Problem