If it is impossible .
if ( need_maximum > num_max or need_minimum > num_min ) : NEW_LINE INDENT return - 1 NEW_LINE DEDENT else : NEW_LINE INDENT return ( swaps + need_maximum + need_minimum ) NEW_LINE DEDENT