Calculating the number of particles