Calculating the number of slices