import java.util.*;
public class Main {
    public static void main(String [] args) {
        Scanner sc = new Scanner(System.in);
        long  H = sc.nextLong();
        long num = 2;
        while(num<=H) num*=2;
        System.out.println(num-1);
    }
} import java.util.*; util.* java public class Main {
    public static void main(String [] args) {
        Scanner sc = new Scanner(System.in);
        long  H = sc.nextLong();
        long num = 2;
        while(num<=H) num*=2;
        System.out.println(num-1);
    }
} Main public static void main(String [] args) {
        Scanner sc = new Scanner(System.in);
        long  H = sc.nextLong();
        long num = 2;
        while(num<=H) num*=2;
        System.out.println(num-1);
    } main {
        Scanner sc = new Scanner(System.in);
        long  H = sc.nextLong();
        long num = 2;
        while(num<=H) num*=2;
        System.out.println(num-1);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) long  H = sc.nextLong(); H sc.nextLong() sc.nextLong sc long num = 2; num 2 while(num<=H) num*=2; num<=H num H num*=2 num 2 System.out.println(num-1) System.out.println System.out System System.out num-1 num 1 String [] args args public class Main {
    public static void main(String [] args) {
        Scanner sc = new Scanner(System.in);
        long  H = sc.nextLong();
        long num = 2;
        while(num<=H) num*=2;
        System.out.println(num-1);
    }
} public class Main {
    public static void main(String [] args) {
        Scanner sc = new Scanner(System.in);
        long  H = sc.nextLong();
        long num = 2;
        while(num<=H) num*=2;
        System.out.println(num-1);
    }
} Main
import java.util.*;
public class Main {
    public static void main(String [] args) {
        Scanner sc = new Scanner(System.in);
        long  H = sc.nextLong();
        long num = 2;
        while(num<=H) num*=2;
        System.out.println(num-1);
    }
}