Counting the number of ways to select objects