added find number of rotation algo