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