#include <stdio.h>
#include <math.h>
int binaryLength1(int i) {
    if (i == 0) return 1; 
    int k = 1;
    i = i / 2;
    while (i > 0) {
        k++;
        i = i / 2;
    }
    return k;
}
int binaryLength2(int n) {
    if (n == 0) return 1; 
    return (int)(log2(n)) + 1; 
}
int binaryLength3(int n) {
    if (n == 0) return 1; 
    int length = 0;
    while (n > 0) {
        n >>= 1; // 右移一位，相当于除以2
        length++;
    }
    return length;
}
int main(){
    printf("%d\n",binaryLength1(8));
    printf("%d\n",binaryLength2(8));
    printf("%d\n",binaryLength3(8));
}