How Fermat is this number? Fermat numbers are positive integers that can be expressed as 22x+1 with an integer x.

Let us now define an attribute of a number called "Fermat-ness":


The Fermat-ness of the number is one less than the length of the chain of powers of two, starting from the base, with powers of two expanded so as to maximize the fermat-ness.
A number that is not a Fermat number has the Fermat-ness of zero.


So, 17 (=22220+1) has Fermat-ness three.

Challenge

Given a positive nonzero integer as input, output the Fermat-ness of the number.

Rules


You may take the input in binary, decimal, hexadecimal, as a bignum, or whatever format lets you golf best
Your solution must be able to process numbers with bit-lengths over 64 whichever representation you use.
Nonnegative integer powers only.
Standard loopholes are of course prohibited.
This is code-golf, so shortest answer wins.


Test cases

These are in format input-&gt;output. The input is in hexadecimal to save space.

10000000000000000000000000000000000000000000000000000000000000001 -&gt; 2
1000000000000BC00000000000000000000000000000000001000000000000001 -&gt;0
1234567890ABCDEF -&gt; 0
100000000000000000000000000000001 -&gt; 1
5 -&gt; 2
11 -&gt; 3
10001 -&gt; 4
101 -&gt; 1


The same in decimal:

115792089237316195423570985008687907853269984665640564039457584007913129639937 -&gt; 2
115792089237316497527923305698859709742143344804209838213621568094470773145601 -&gt; 0
1311768467294899695 -&gt; 0
340282366920938463463374607431768211457 -&gt; 1
5 -&gt;2
17 -&gt; 3
65537 -&gt; 4
257 -&gt; 1


Thanks to geokavel for invaluable input in the sandbox.
Jelly, 15 14 bytes

1 byte thanks to Jonathan Allan.

’µBḊ⁸LṀ?µÐĿḊḊL


Try it online!