inf=1000000
ans=$inf
for a in $(tail -1); do
    c=$(bc <<< "obase=2;$a" | sed 's/^.*1\(0*\)$/\1/' | tr -d '\n' | wc -c)
    ans=$(( ans < c ? ans : c ))  # min(ans, c)
done

if [ $ans -eq $inf ]; then
    echo 0
else
    printf "%d\n" $ans
fi
