import java.io.*;
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int x = sc.nextInt();
		
		int test = 1;
		int currentHighestDivisible = 0;
		int currentWinner = 1;
		
		while (test <= x) {
			int testDividedByTwo = test;
			int testFactorsOfTwo = 0;
			while (testDividedByTwo % 2 == 0) {
				testFactorsOfTwo += 1;
				testDividedByTwo = testDividedByTwo/2;
			}
			if (testFactorsOfTwo > currentHighestDivisible) {
				currentWinner = test;
				currentHighestDivisible = testFactorsOfTwo;
				test += 1;
			} else {
				test += 1;
			}
		}
		System.out.println(currentWinner);
	}
} import java.io.*; io.* java import java.util.*; util.* java public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int x = sc.nextInt();
		
		int test = 1;
		int currentHighestDivisible = 0;
		int currentWinner = 1;
		
		while (test <= x) {
			int testDividedByTwo = test;
			int testFactorsOfTwo = 0;
			while (testDividedByTwo % 2 == 0) {
				testFactorsOfTwo += 1;
				testDividedByTwo = testDividedByTwo/2;
			}
			if (testFactorsOfTwo > currentHighestDivisible) {
				currentWinner = test;
				currentHighestDivisible = testFactorsOfTwo;
				test += 1;
			} else {
				test += 1;
			}
		}
		System.out.println(currentWinner);
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int x = sc.nextInt();
		
		int test = 1;
		int currentHighestDivisible = 0;
		int currentWinner = 1;
		
		while (test <= x) {
			int testDividedByTwo = test;
			int testFactorsOfTwo = 0;
			while (testDividedByTwo % 2 == 0) {
				testFactorsOfTwo += 1;
				testDividedByTwo = testDividedByTwo/2;
			}
			if (testFactorsOfTwo > currentHighestDivisible) {
				currentWinner = test;
				currentHighestDivisible = testFactorsOfTwo;
				test += 1;
			} else {
				test += 1;
			}
		}
		System.out.println(currentWinner);
	} main {
		Scanner sc = new Scanner(System.in);
		
		int x = sc.nextInt();
		
		int test = 1;
		int currentHighestDivisible = 0;
		int currentWinner = 1;
		
		while (test <= x) {
			int testDividedByTwo = test;
			int testFactorsOfTwo = 0;
			while (testDividedByTwo % 2 == 0) {
				testFactorsOfTwo += 1;
				testDividedByTwo = testDividedByTwo/2;
			}
			if (testFactorsOfTwo > currentHighestDivisible) {
				currentWinner = test;
				currentHighestDivisible = testFactorsOfTwo;
				test += 1;
			} else {
				test += 1;
			}
		}
		System.out.println(currentWinner);
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int x = sc.nextInt(); x sc.nextInt() sc.nextInt sc int test = 1; test 1 int currentHighestDivisible = 0; currentHighestDivisible 0 int currentWinner = 1; currentWinner 1 while (test <= x) {
			int testDividedByTwo = test;
			int testFactorsOfTwo = 0;
			while (testDividedByTwo % 2 == 0) {
				testFactorsOfTwo += 1;
				testDividedByTwo = testDividedByTwo/2;
			}
			if (testFactorsOfTwo > currentHighestDivisible) {
				currentWinner = test;
				currentHighestDivisible = testFactorsOfTwo;
				test += 1;
			} else {
				test += 1;
			}
		} test <= x test x {
			int testDividedByTwo = test;
			int testFactorsOfTwo = 0;
			while (testDividedByTwo % 2 == 0) {
				testFactorsOfTwo += 1;
				testDividedByTwo = testDividedByTwo/2;
			}
			if (testFactorsOfTwo > currentHighestDivisible) {
				currentWinner = test;
				currentHighestDivisible = testFactorsOfTwo;
				test += 1;
			} else {
				test += 1;
			}
		} int testDividedByTwo = test; testDividedByTwo test int testFactorsOfTwo = 0; testFactorsOfTwo 0 while (testDividedByTwo % 2 == 0) {
				testFactorsOfTwo += 1;
				testDividedByTwo = testDividedByTwo/2;
			} testDividedByTwo % 2 == 0 testDividedByTwo % 2 testDividedByTwo 2 0 {
				testFactorsOfTwo += 1;
				testDividedByTwo = testDividedByTwo/2;
			} testFactorsOfTwo += 1 testFactorsOfTwo 1 testDividedByTwo = testDividedByTwo/2 testDividedByTwo testDividedByTwo/2 testDividedByTwo 2 if (testFactorsOfTwo > currentHighestDivisible) {
				currentWinner = test;
				currentHighestDivisible = testFactorsOfTwo;
				test += 1;
			} else {
				test += 1;
			} testFactorsOfTwo > currentHighestDivisible testFactorsOfTwo currentHighestDivisible {
				currentWinner = test;
				currentHighestDivisible = testFactorsOfTwo;
				test += 1;
			} currentWinner = test currentWinner test currentHighestDivisible = testFactorsOfTwo currentHighestDivisible testFactorsOfTwo test += 1 test 1 {
				test += 1;
			} test += 1 test 1 System.out.println(currentWinner) System.out.println System.out System System.out currentWinner String[] args args public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int x = sc.nextInt();
		
		int test = 1;
		int currentHighestDivisible = 0;
		int currentWinner = 1;
		
		while (test <= x) {
			int testDividedByTwo = test;
			int testFactorsOfTwo = 0;
			while (testDividedByTwo % 2 == 0) {
				testFactorsOfTwo += 1;
				testDividedByTwo = testDividedByTwo/2;
			}
			if (testFactorsOfTwo > currentHighestDivisible) {
				currentWinner = test;
				currentHighestDivisible = testFactorsOfTwo;
				test += 1;
			} else {
				test += 1;
			}
		}
		System.out.println(currentWinner);
	}
} public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int x = sc.nextInt();
		
		int test = 1;
		int currentHighestDivisible = 0;
		int currentWinner = 1;
		
		while (test <= x) {
			int testDividedByTwo = test;
			int testFactorsOfTwo = 0;
			while (testDividedByTwo % 2 == 0) {
				testFactorsOfTwo += 1;
				testDividedByTwo = testDividedByTwo/2;
			}
			if (testFactorsOfTwo > currentHighestDivisible) {
				currentWinner = test;
				currentHighestDivisible = testFactorsOfTwo;
				test += 1;
			} else {
				test += 1;
			}
		}
		System.out.println(currentWinner);
	}
} Main
import java.io.*;
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int x = sc.nextInt();
		
		int test = 1;
		int currentHighestDivisible = 0;
		int currentWinner = 1;
		
		while (test <= x) {
			int testDividedByTwo = test;
			int testFactorsOfTwo = 0;
			while (testDividedByTwo % 2 == 0) {
				testFactorsOfTwo += 1;
				testDividedByTwo = testDividedByTwo/2;
			}
			if (testFactorsOfTwo > currentHighestDivisible) {
				currentWinner = test;
				currentHighestDivisible = testFactorsOfTwo;
				test += 1;
			} else {
				test += 1;
			}
		}
		System.out.println(currentWinner);
	}
}
