
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long num = Long.parseLong(sc.nextLine());
		Main main = new Main();
		int pow = main.divcount(num, 0);
		double ans = 0;
		for (int i = 0; i <= pow; i++) {
			ans += Math.pow(2, i);
		}
		System.out.println((long)ans);
	}

	public int divcount(long num,int con) {
		if (num > 1) {
			return divcount(num / 2, ++con);
		}
		return con;
	}

} import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long num = Long.parseLong(sc.nextLine());
		Main main = new Main();
		int pow = main.divcount(num, 0);
		double ans = 0;
		for (int i = 0; i <= pow; i++) {
			ans += Math.pow(2, i);
		}
		System.out.println((long)ans);
	}

	public int divcount(long num,int con) {
		if (num > 1) {
			return divcount(num / 2, ++con);
		}
		return con;
	}

} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long num = Long.parseLong(sc.nextLine());
		Main main = new Main();
		int pow = main.divcount(num, 0);
		double ans = 0;
		for (int i = 0; i <= pow; i++) {
			ans += Math.pow(2, i);
		}
		System.out.println((long)ans);
	} main {
		Scanner sc = new Scanner(System.in);
		long num = Long.parseLong(sc.nextLine());
		Main main = new Main();
		int pow = main.divcount(num, 0);
		double ans = 0;
		for (int i = 0; i <= pow; i++) {
			ans += Math.pow(2, i);
		}
		System.out.println((long)ans);
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) long num = Long.parseLong(sc.nextLine()); num Long.parseLong(sc.nextLine()) Long.parseLong Long sc.nextLine() sc.nextLine sc Main main = new Main(); main new Main() int pow = main.divcount(num, 0); pow main.divcount(num, 0) main.divcount main num 0 double ans = 0; ans 0 for (int i = 0; i <= pow; i++) {
			ans += Math.pow(2, i);
		} int i = 0; int i = 0; i 0 i <= pow i pow i++ i++ i {
			ans += Math.pow(2, i);
		} {
			ans += Math.pow(2, i);
		} ans += Math.pow(2, i) ans Math.pow(2, i) Math.pow Math 2 i System.out.println((long)ans) System.out.println System.out System System.out (long)ans String[] args args public int divcount(long num,int con) {
		if (num > 1) {
			return divcount(num / 2, ++con);
		}
		return con;
	} divcount {
		if (num > 1) {
			return divcount(num / 2, ++con);
		}
		return con;
	} if (num > 1) {
			return divcount(num / 2, ++con);
		} num > 1 num 1 {
			return divcount(num / 2, ++con);
		} return divcount(num / 2, ++con); divcount(num / 2, ++con) divcount num / 2 num 2 ++con con return con; con long num num int con con public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long num = Long.parseLong(sc.nextLine());
		Main main = new Main();
		int pow = main.divcount(num, 0);
		double ans = 0;
		for (int i = 0; i <= pow; i++) {
			ans += Math.pow(2, i);
		}
		System.out.println((long)ans);
	}

	public int divcount(long num,int con) {
		if (num > 1) {
			return divcount(num / 2, ++con);
		}
		return con;
	}

} public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long num = Long.parseLong(sc.nextLine());
		Main main = new Main();
		int pow = main.divcount(num, 0);
		double ans = 0;
		for (int i = 0; i <= pow; i++) {
			ans += Math.pow(2, i);
		}
		System.out.println((long)ans);
	}

	public int divcount(long num,int con) {
		if (num > 1) {
			return divcount(num / 2, ++con);
		}
		return con;
	}

} Main

import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long num = Long.parseLong(sc.nextLine());
		Main main = new Main();
		int pow = main.divcount(num, 0);
		double ans = 0;
		for (int i = 0; i <= pow; i++) {
			ans += Math.pow(2, i);
		}
		System.out.println((long)ans);
	}

	public int divcount(long num,int con) {
		if (num > 1) {
			return divcount(num / 2, ++con);
		}
		return con;
	}

}