
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        
        int ans = 1;
        for (int i = n; 0 < i; i--) {
        	int cnt = 0;
        	for (int j = 2;; j *= 2) {
        		if (i % j == 0) {
        			cnt = j;
        		} else {
        			break;
        		}
        	}
        	ans = Math.max(ans, cnt);
		}
        
        System.out.println(ans);
    }
} import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        
        int ans = 1;
        for (int i = n; 0 < i; i--) {
        	int cnt = 0;
        	for (int j = 2;; j *= 2) {
        		if (i % j == 0) {
        			cnt = j;
        		} else {
        			break;
        		}
        	}
        	ans = Math.max(ans, cnt);
		}
        
        System.out.println(ans);
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        
        int ans = 1;
        for (int i = n; 0 < i; i--) {
        	int cnt = 0;
        	for (int j = 2;; j *= 2) {
        		if (i % j == 0) {
        			cnt = j;
        		} else {
        			break;
        		}
        	}
        	ans = Math.max(ans, cnt);
		}
        
        System.out.println(ans);
    } main {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        
        int ans = 1;
        for (int i = n; 0 < i; i--) {
        	int cnt = 0;
        	for (int j = 2;; j *= 2) {
        		if (i % j == 0) {
        			cnt = j;
        		} else {
        			break;
        		}
        	}
        	ans = Math.max(ans, cnt);
		}
        
        System.out.println(ans);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc int ans = 1; ans 1 for (int i = n; 0 < i; i--) {
        	int cnt = 0;
        	for (int j = 2;; j *= 2) {
        		if (i % j == 0) {
        			cnt = j;
        		} else {
        			break;
        		}
        	}
        	ans = Math.max(ans, cnt);
		} int i = n; int i = n; i n 0 < i 0 i i-- i-- i {
        	int cnt = 0;
        	for (int j = 2;; j *= 2) {
        		if (i % j == 0) {
        			cnt = j;
        		} else {
        			break;
        		}
        	}
        	ans = Math.max(ans, cnt);
		} {
        	int cnt = 0;
        	for (int j = 2;; j *= 2) {
        		if (i % j == 0) {
        			cnt = j;
        		} else {
        			break;
        		}
        	}
        	ans = Math.max(ans, cnt);
		} int cnt = 0; cnt 0 for (int j = 2;; j *= 2) {
        		if (i % j == 0) {
        			cnt = j;
        		} else {
        			break;
        		}
        	} int j = 2; int j = 2; j 2 j *= 2 j *= 2 j 2 {
        		if (i % j == 0) {
        			cnt = j;
        		} else {
        			break;
        		}
        	} {
        		if (i % j == 0) {
        			cnt = j;
        		} else {
        			break;
        		}
        	} if (i % j == 0) {
        			cnt = j;
        		} else {
        			break;
        		} i % j == 0 i % j i j 0 {
        			cnt = j;
        		} cnt = j cnt j {
        			break;
        		} break; ans = Math.max(ans, cnt) ans Math.max(ans, cnt) Math.max Math ans cnt System.out.println(ans) System.out.println System.out System System.out ans String[] args args public class Main {
	public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        
        int ans = 1;
        for (int i = n; 0 < i; i--) {
        	int cnt = 0;
        	for (int j = 2;; j *= 2) {
        		if (i % j == 0) {
        			cnt = j;
        		} else {
        			break;
        		}
        	}
        	ans = Math.max(ans, cnt);
		}
        
        System.out.println(ans);
    }
} public class Main {
	public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        
        int ans = 1;
        for (int i = n; 0 < i; i--) {
        	int cnt = 0;
        	for (int j = 2;; j *= 2) {
        		if (i % j == 0) {
        			cnt = j;
        		} else {
        			break;
        		}
        	}
        	ans = Math.max(ans, cnt);
		}
        
        System.out.println(ans);
    }
} Main

import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        
        int ans = 1;
        for (int i = n; 0 < i; i--) {
        	int cnt = 0;
        	for (int j = 2;; j *= 2) {
        		if (i % j == 0) {
        			cnt = j;
        		} else {
        			break;
        		}
        	}
        	ans = Math.max(ans, cnt);
		}
        
        System.out.println(ans);
    }
}