Calculating the number of successful outcomes