import java.util.*;  

public class Main {
	public static Long ln(Long x){
        if(x<=1) return x;                                                          
        return 1+2*ln(x/2);                                                                                                                                                                                                                
    }
    public static Long gcd(Long x,Long y){
        if(x < y) return gcd(y, x);
        if(y == 0) return x;
        return gcd(y, x % y);
    }
    public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		Long a = sc.nextLong();
        Long b = ln(a);
		System.out.println(b);   
	}   
}
 import java.util.*; util.* java public class Main {
	public static Long ln(Long x){
        if(x<=1) return x;                                                          
        return 1+2*ln(x/2);                                                                                                                                                                                                                
    }
    public static Long gcd(Long x,Long y){
        if(x < y) return gcd(y, x);
        if(y == 0) return x;
        return gcd(y, x % y);
    }
    public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		Long a = sc.nextLong();
        Long b = ln(a);
		System.out.println(b);   
	}   
} Main public static Long ln(Long x){
        if(x<=1) return x;                                                          
        return 1+2*ln(x/2);                                                                                                                                                                                                                
    } ln {
        if(x<=1) return x;                                                          
        return 1+2*ln(x/2);                                                                                                                                                                                                                
    } if(x<=1) return x; x<=1 x 1 return x; x return 1+2*ln(x/2); 1+2*ln(x/2) 1 2*ln(x/2) 2 ln(x/2) ln x/2 x 2 Long x x public static Long gcd(Long x,Long y){
        if(x < y) return gcd(y, x);
        if(y == 0) return x;
        return gcd(y, x % y);
    } gcd {
        if(x < y) return gcd(y, x);
        if(y == 0) return x;
        return gcd(y, x % y);
    } if(x < y) return gcd(y, x); x < y x y return gcd(y, x); gcd(y, x) gcd y x if(y == 0) return x; y == 0 y 0 return x; x return gcd(y, x % y); gcd(y, x % y) gcd y x % y x y Long x x Long y y public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		Long a = sc.nextLong();
        Long b = ln(a);
		System.out.println(b);   
	} main {
		Scanner sc = new Scanner(System.in);
		Long a = sc.nextLong();
        Long b = ln(a);
		System.out.println(b);   
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) Long a = sc.nextLong(); a sc.nextLong() sc.nextLong sc Long b = ln(a); b ln(a) ln a System.out.println(b) System.out.println System.out System System.out b String[] args args public class Main {
	public static Long ln(Long x){
        if(x<=1) return x;                                                          
        return 1+2*ln(x/2);                                                                                                                                                                                                                
    }
    public static Long gcd(Long x,Long y){
        if(x < y) return gcd(y, x);
        if(y == 0) return x;
        return gcd(y, x % y);
    }
    public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		Long a = sc.nextLong();
        Long b = ln(a);
		System.out.println(b);   
	}   
} public class Main {
	public static Long ln(Long x){
        if(x<=1) return x;                                                          
        return 1+2*ln(x/2);                                                                                                                                                                                                                
    }
    public static Long gcd(Long x,Long y){
        if(x < y) return gcd(y, x);
        if(y == 0) return x;
        return gcd(y, x % y);
    }
    public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		Long a = sc.nextLong();
        Long b = ln(a);
		System.out.println(b);   
	}   
} Main
import java.util.*;  

public class Main {
	public static Long ln(Long x){
        if(x<=1) return x;                                                          
        return 1+2*ln(x/2);                                                                                                                                                                                                                
    }
    public static Long gcd(Long x,Long y){
        if(x < y) return gcd(y, x);
        if(y == 0) return x;
        return gcd(y, x % y);
    }
    public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		Long a = sc.nextLong();
        Long b = ln(a);
		System.out.println(b);   
	}   
}

