# [Wise], <s>40</s> 39 bytes

    ::^?[:::^~-&[-~!-~-~?]!~-?|>]|:[>-?>?]|

[Try it online!][TIO-j52kehui]

[Wise]: https://github.com/Wheatwizard/Wise
[TIO-j52kehui]: https://tio.run/##K88sTv3/38oqzj7aCkjW6apF69Yp6tbp1tnHKtbp2tfYxdZYRdvp2tvZx9b8///fyNDE3MTC2MzEAgA "Wise – Try It Online"

## Explanation

    ::^?                                      Put a zero on the bottom
        [                                     While
         :::^~-&                              Get the last bit
                [-~!-~-~?]!~-?|               Increment counter if 0 decrement if 1
                               >              Remove the last bit
                                ]|            End while
                                  :[>-?>?]|   Get the sign