new room count algorithm