import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;

public class Main {
	static long n;

	public static void main(String args[]) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		n = Long.parseLong(br.readLine());

		for (long i = 1;; i++) {
			long a = (long) Math.pow(2, i);

			if (n < a) {
				System.out.println((long) Math.pow(2, i) - 1);
				return;
			}
		}
	}
} import java.io.BufferedReader; BufferedReader java.io import java.io.IOException; IOException java.io import java.io.InputStreamReader; InputStreamReader java.io import java.util.Arrays; Arrays java.util public class Main {
	static long n;

	public static void main(String args[]) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		n = Long.parseLong(br.readLine());

		for (long i = 1;; i++) {
			long a = (long) Math.pow(2, i);

			if (n < a) {
				System.out.println((long) Math.pow(2, i) - 1);
				return;
			}
		}
	}
} Main static long n; n public static void main(String args[]) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		n = Long.parseLong(br.readLine());

		for (long i = 1;; i++) {
			long a = (long) Math.pow(2, i);

			if (n < a) {
				System.out.println((long) Math.pow(2, i) - 1);
				return;
			}
		}
	} main {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		n = Long.parseLong(br.readLine());

		for (long i = 1;; i++) {
			long a = (long) Math.pow(2, i);

			if (n < a) {
				System.out.println((long) Math.pow(2, i) - 1);
				return;
			}
		}
	} BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) n = Long.parseLong(br.readLine()) n Long.parseLong(br.readLine()) Long.parseLong Long br.readLine() br.readLine br for (long i = 1;; i++) {
			long a = (long) Math.pow(2, i);

			if (n < a) {
				System.out.println((long) Math.pow(2, i) - 1);
				return;
			}
		} long i = 1; long i = 1; i 1 i++ i++ i {
			long a = (long) Math.pow(2, i);

			if (n < a) {
				System.out.println((long) Math.pow(2, i) - 1);
				return;
			}
		} {
			long a = (long) Math.pow(2, i);

			if (n < a) {
				System.out.println((long) Math.pow(2, i) - 1);
				return;
			}
		} long a = (long) Math.pow(2, i); a (long) Math.pow(2, i) Math.pow Math 2 i if (n < a) {
				System.out.println((long) Math.pow(2, i) - 1);
				return;
			} n < a n a {
				System.out.println((long) Math.pow(2, i) - 1);
				return;
			} System.out.println((long) Math.pow(2, i) - 1) System.out.println System.out System System.out (long) Math.pow(2, i) - 1 (long) Math.pow(2, i) Math.pow Math 2 i 1 return; String args[] args public class Main {
	static long n;

	public static void main(String args[]) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		n = Long.parseLong(br.readLine());

		for (long i = 1;; i++) {
			long a = (long) Math.pow(2, i);

			if (n < a) {
				System.out.println((long) Math.pow(2, i) - 1);
				return;
			}
		}
	}
} public class Main {
	static long n;

	public static void main(String args[]) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		n = Long.parseLong(br.readLine());

		for (long i = 1;; i++) {
			long a = (long) Math.pow(2, i);

			if (n < a) {
				System.out.println((long) Math.pow(2, i) - 1);
				return;
			}
		}
	}
} Main
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;

public class Main {
	static long n;

	public static void main(String args[]) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		n = Long.parseLong(br.readLine());

		for (long i = 1;; i++) {
			long a = (long) Math.pow(2, i);

			if (n < a) {
				System.out.println((long) Math.pow(2, i) - 1);
				return;
			}
		}
	}
}
