# [MATL], 7 bytes

    3X2Z%Bz

[Try it online!][TIO-j5o4vwi9]

[MATL]: https://github.com/lmendo/MATL
[TIO-j5o4vwi9]: https://tio.run/##y00syfn/3zjCKErVqer/fyMjAA "MATL – Try It Online"

Exact transliteration of my MATLAB answer. Note that input and output are implicit.