Condition to choose the operations greedily
if ( n % 5 == 0 ) : NEW_LINE INDENT ans = ans + 1 NEW_LINE n = n / 5 NEW_LINE continue NEW_LINE DEDENT elif ( n % 4 == 0 ) : NEW_LINE INDENT ans = ans + 1 NEW_LINE n = n / 4 NEW_LINE continue NEW_LINE DEDENT elif ( n % 3 == 0 ) : NEW_LINE INDENT ans = ans + 1 NEW_LINE n = n / 3 NEW_LINE continue NEW_LINE DEDENT elif ( n % 2 == 0 ) : NEW_LINE INDENT ans = ans + 1 NEW_LINE n = n / 2 NEW_LINE continue NEW_LINE DEDENT return - 1 NEW_LINE return ans NEW_LINE