Calculating the number of different combinations