Determining number of factors