import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class Main {
    static class FastReader{
        BufferedReader br,br1;
        StringTokenizer st;
        public FastReader() {br = new BufferedReader(new InputStreamReader(System.in));}
        public FastReader(String fileName) throws FileNotFoundException{br = new BufferedReader(new FileReader(fileName));}
        String next() {while (st == null || !st.hasMoreElements()){try{st = new StringTokenizer(br.readLine());}catch (IOException  e){e.printStackTrace();}}return st.nextToken();}
        int nextInt() {return Integer.parseInt(next());}
        long nextLong() {return Long.parseLong(next());}
        double nextDouble() {return Double.parseDouble(next());}
        char[][] readCharArray(int n, int m) {
        	String str;
        	char[][] arr = new char[n][m];
        	for(int i = 0; i < n; ++i) {
        		str=nextLine();
        		for(int j = 0;j < n; ++j) {
        			arr[i][j] = str.charAt(j);
        		}
        	}
        	return arr;
        }
        char[][] readCharArray(int n) {
        	return readCharArray(n,n);
        }
        int[] readArray(int n) {int[] a = new int[n]; for (int i = 0; i < n; ++i) a[i] = nextInt(); return a;}
        long[] readLongArray(int n) {long[] a=new long[n];for (int i = 0; i < n; ++i) a[i] = nextLong(); return a;}
        String nextLine() {String str = "";try{str = br.readLine();} catch (IOException e){e.printStackTrace();} return str;}
    }
    public static void main(String[] args) throws NumberFormatException, IOException {
        FastReader fs = new FastReader();
        PrintWriter out = new PrintWriter(System.out);
        int n = fs.nextInt();
        int ans = 0, cnt1 = -1;
        for (int i = 1; i <= n; ++i) {
            int temp = i;
            int cnt = 0;
            while (temp % 2 == 0) {
                temp /= 2;
                ++cnt;
            }
            if (cnt >= cnt1) {
                cnt1 = cnt;
                ans = i;
            }
        }
        out.println(ans);
        out.close();
    }

} import java.io.BufferedReader; BufferedReader java.io import java.io.FileNotFoundException; FileNotFoundException java.io import java.io.FileReader; FileReader java.io import java.io.IOException; IOException java.io import java.io.InputStreamReader; InputStreamReader java.io import java.io.PrintWriter; PrintWriter java.io import java.util.StringTokenizer; StringTokenizer java.util public class Main {
    static class FastReader{
        BufferedReader br,br1;
        StringTokenizer st;
        public FastReader() {br = new BufferedReader(new InputStreamReader(System.in));}
        public FastReader(String fileName) throws FileNotFoundException{br = new BufferedReader(new FileReader(fileName));}
        String next() {while (st == null || !st.hasMoreElements()){try{st = new StringTokenizer(br.readLine());}catch (IOException  e){e.printStackTrace();}}return st.nextToken();}
        int nextInt() {return Integer.parseInt(next());}
        long nextLong() {return Long.parseLong(next());}
        double nextDouble() {return Double.parseDouble(next());}
        char[][] readCharArray(int n, int m) {
        	String str;
        	char[][] arr = new char[n][m];
        	for(int i = 0; i < n; ++i) {
        		str=nextLine();
        		for(int j = 0;j < n; ++j) {
        			arr[i][j] = str.charAt(j);
        		}
        	}
        	return arr;
        }
        char[][] readCharArray(int n) {
        	return readCharArray(n,n);
        }
        int[] readArray(int n) {int[] a = new int[n]; for (int i = 0; i < n; ++i) a[i] = nextInt(); return a;}
        long[] readLongArray(int n) {long[] a=new long[n];for (int i = 0; i < n; ++i) a[i] = nextLong(); return a;}
        String nextLine() {String str = "";try{str = br.readLine();} catch (IOException e){e.printStackTrace();} return str;}
    }
    public static void main(String[] args) throws NumberFormatException, IOException {
        FastReader fs = new FastReader();
        PrintWriter out = new PrintWriter(System.out);
        int n = fs.nextInt();
        int ans = 0, cnt1 = -1;
        for (int i = 1; i <= n; ++i) {
            int temp = i;
            int cnt = 0;
            while (temp % 2 == 0) {
                temp /= 2;
                ++cnt;
            }
            if (cnt >= cnt1) {
                cnt1 = cnt;
                ans = i;
            }
        }
        out.println(ans);
        out.close();
    }

} Main public static void main(String[] args) throws NumberFormatException, IOException {
        FastReader fs = new FastReader();
        PrintWriter out = new PrintWriter(System.out);
        int n = fs.nextInt();
        int ans = 0, cnt1 = -1;
        for (int i = 1; i <= n; ++i) {
            int temp = i;
            int cnt = 0;
            while (temp % 2 == 0) {
                temp /= 2;
                ++cnt;
            }
            if (cnt >= cnt1) {
                cnt1 = cnt;
                ans = i;
            }
        }
        out.println(ans);
        out.close();
    } main {
        FastReader fs = new FastReader();
        PrintWriter out = new PrintWriter(System.out);
        int n = fs.nextInt();
        int ans = 0, cnt1 = -1;
        for (int i = 1; i <= n; ++i) {
            int temp = i;
            int cnt = 0;
            while (temp % 2 == 0) {
                temp /= 2;
                ++cnt;
            }
            if (cnt >= cnt1) {
                cnt1 = cnt;
                ans = i;
            }
        }
        out.println(ans);
        out.close();
    } FastReader fs = new FastReader(); fs new FastReader() PrintWriter out = new PrintWriter(System.out); out new PrintWriter(System.out) int n = fs.nextInt(); n fs.nextInt() fs.nextInt fs int ans = 0 ans 0 cnt1 = -1; cnt1 -1 1 for (int i = 1; i <= n; ++i) {
            int temp = i;
            int cnt = 0;
            while (temp % 2 == 0) {
                temp /= 2;
                ++cnt;
            }
            if (cnt >= cnt1) {
                cnt1 = cnt;
                ans = i;
            }
        } int i = 1; int i = 1; i 1 i <= n i n ++i ++i i {
            int temp = i;
            int cnt = 0;
            while (temp % 2 == 0) {
                temp /= 2;
                ++cnt;
            }
            if (cnt >= cnt1) {
                cnt1 = cnt;
                ans = i;
            }
        } {
            int temp = i;
            int cnt = 0;
            while (temp % 2 == 0) {
                temp /= 2;
                ++cnt;
            }
            if (cnt >= cnt1) {
                cnt1 = cnt;
                ans = i;
            }
        } int temp = i; temp i int cnt = 0; cnt 0 while (temp % 2 == 0) {
                temp /= 2;
                ++cnt;
            } temp % 2 == 0 temp % 2 temp 2 0 {
                temp /= 2;
                ++cnt;
            } temp /= 2 temp 2 ++cnt cnt if (cnt >= cnt1) {
                cnt1 = cnt;
                ans = i;
            } cnt >= cnt1 cnt cnt1 {
                cnt1 = cnt;
                ans = i;
            } cnt1 = cnt cnt1 cnt ans = i ans i out.println(ans) out.println out ans out.close() out.close out String[] args args static class FastReader{
        BufferedReader br,br1;
        StringTokenizer st;
        public FastReader() {br = new BufferedReader(new InputStreamReader(System.in));}
        public FastReader(String fileName) throws FileNotFoundException{br = new BufferedReader(new FileReader(fileName));}
        String next() {while (st == null || !st.hasMoreElements()){try{st = new StringTokenizer(br.readLine());}catch (IOException  e){e.printStackTrace();}}return st.nextToken();}
        int nextInt() {return Integer.parseInt(next());}
        long nextLong() {return Long.parseLong(next());}
        double nextDouble() {return Double.parseDouble(next());}
        char[][] readCharArray(int n, int m) {
        	String str;
        	char[][] arr = new char[n][m];
        	for(int i = 0; i < n; ++i) {
        		str=nextLine();
        		for(int j = 0;j < n; ++j) {
        			arr[i][j] = str.charAt(j);
        		}
        	}
        	return arr;
        }
        char[][] readCharArray(int n) {
        	return readCharArray(n,n);
        }
        int[] readArray(int n) {int[] a = new int[n]; for (int i = 0; i < n; ++i) a[i] = nextInt(); return a;}
        long[] readLongArray(int n) {long[] a=new long[n];for (int i = 0; i < n; ++i) a[i] = nextLong(); return a;}
        String nextLine() {String str = "";try{str = br.readLine();} catch (IOException e){e.printStackTrace();} return str;}
    } FastReader BufferedReader br br br1; br1 StringTokenizer st; st public FastReader() {br = new BufferedReader(new InputStreamReader(System.in));} FastReader {br = new BufferedReader(new InputStreamReader(System.in));} br = new BufferedReader(new InputStreamReader(System.in)) br new BufferedReader(new InputStreamReader(System.in)) public FastReader(String fileName) throws FileNotFoundException{br = new BufferedReader(new FileReader(fileName));} FastReader {br = new BufferedReader(new FileReader(fileName));} br = new BufferedReader(new FileReader(fileName)) br new BufferedReader(new FileReader(fileName)) String fileName fileName String next() {while (st == null || !st.hasMoreElements()){try{st = new StringTokenizer(br.readLine());}catch (IOException  e){e.printStackTrace();}}return st.nextToken();} next {while (st == null || !st.hasMoreElements()){try{st = new StringTokenizer(br.readLine());}catch (IOException  e){e.printStackTrace();}}return st.nextToken();} while (st == null || !st.hasMoreElements()){try{st = new StringTokenizer(br.readLine());}catch (IOException  e){e.printStackTrace();}} st == null || !st.hasMoreElements() st == null st null !st.hasMoreElements() st.hasMoreElements() st.hasMoreElements st {try{st = new StringTokenizer(br.readLine());}catch (IOException  e){e.printStackTrace();}} try{st = new StringTokenizer(br.readLine());}catch (IOException  e){e.printStackTrace();} catch (IOException  e){e.printStackTrace();} IOException  e {e.printStackTrace();} e.printStackTrace() e.printStackTrace e {st = new StringTokenizer(br.readLine());} st = new StringTokenizer(br.readLine()) st new StringTokenizer(br.readLine()) return st.nextToken(); st.nextToken() st.nextToken st int nextInt() {return Integer.parseInt(next());} nextInt {return Integer.parseInt(next());} return Integer.parseInt(next()); Integer.parseInt(next()) Integer.parseInt Integer next() next long nextLong() {return Long.parseLong(next());} nextLong {return Long.parseLong(next());} return Long.parseLong(next()); Long.parseLong(next()) Long.parseLong Long next() next double nextDouble() {return Double.parseDouble(next());} nextDouble {return Double.parseDouble(next());} return Double.parseDouble(next()); Double.parseDouble(next()) Double.parseDouble Double next() next char[][] readCharArray(int n, int m) {
        	String str;
        	char[][] arr = new char[n][m];
        	for(int i = 0; i < n; ++i) {
        		str=nextLine();
        		for(int j = 0;j < n; ++j) {
        			arr[i][j] = str.charAt(j);
        		}
        	}
        	return arr;
        } readCharArray {
        	String str;
        	char[][] arr = new char[n][m];
        	for(int i = 0; i < n; ++i) {
        		str=nextLine();
        		for(int j = 0;j < n; ++j) {
        			arr[i][j] = str.charAt(j);
        		}
        	}
        	return arr;
        } String str; str char[][] arr = new char[n][m]; arr new char[n][m] n m for(int i = 0; i < n; ++i) {
        		str=nextLine();
        		for(int j = 0;j < n; ++j) {
        			arr[i][j] = str.charAt(j);
        		}
        	} int i = 0; int i = 0; i 0 i < n i n ++i ++i i {
        		str=nextLine();
        		for(int j = 0;j < n; ++j) {
        			arr[i][j] = str.charAt(j);
        		}
        	} {
        		str=nextLine();
        		for(int j = 0;j < n; ++j) {
        			arr[i][j] = str.charAt(j);
        		}
        	} str=nextLine() str nextLine() nextLine for(int j = 0;j < n; ++j) {
        			arr[i][j] = str.charAt(j);
        		} int j = 0; int j = 0; j 0 j < n j n ++j ++j j {
        			arr[i][j] = str.charAt(j);
        		} {
        			arr[i][j] = str.charAt(j);
        		} arr[i][j] = str.charAt(j) arr[i][j] arr[i] arr i j str.charAt(j) str.charAt str j return arr; arr int n n int m m char[][] readCharArray(int n) {
        	return readCharArray(n,n);
        } readCharArray {
        	return readCharArray(n,n);
        } return readCharArray(n,n); readCharArray(n,n) readCharArray n n int n n int[] readArray(int n) {int[] a = new int[n]; for (int i = 0; i < n; ++i) a[i] = nextInt(); return a;} readArray {int[] a = new int[n]; for (int i = 0; i < n; ++i) a[i] = nextInt(); return a;} int[] a = new int[n]; a new int[n] n for (int i = 0; i < n; ++i) a[i] = nextInt(); int i = 0; int i = 0; i 0 i < n i n ++i ++i i a[i] = nextInt(); a[i] = nextInt() a[i] a i nextInt() nextInt return a; a int n n long[] readLongArray(int n) {long[] a=new long[n];for (int i = 0; i < n; ++i) a[i] = nextLong(); return a;} readLongArray {long[] a=new long[n];for (int i = 0; i < n; ++i) a[i] = nextLong(); return a;} long[] a=new long[n]; a new long[n] n for (int i = 0; i < n; ++i) a[i] = nextLong(); int i = 0; int i = 0; i 0 i < n i n ++i ++i i a[i] = nextLong(); a[i] = nextLong() a[i] a i nextLong() nextLong return a; a int n n String nextLine() {String str = "";try{str = br.readLine();} catch (IOException e){e.printStackTrace();} return str;} nextLine {String str = "";try{str = br.readLine();} catch (IOException e){e.printStackTrace();} return str;} String str = ""; str "" try{str = br.readLine();} catch (IOException e){e.printStackTrace();} catch (IOException e){e.printStackTrace();} IOException e {e.printStackTrace();} e.printStackTrace() e.printStackTrace e {str = br.readLine();} str = br.readLine() str br.readLine() br.readLine br return str; str public class Main {
    static class FastReader{
        BufferedReader br,br1;
        StringTokenizer st;
        public FastReader() {br = new BufferedReader(new InputStreamReader(System.in));}
        public FastReader(String fileName) throws FileNotFoundException{br = new BufferedReader(new FileReader(fileName));}
        String next() {while (st == null || !st.hasMoreElements()){try{st = new StringTokenizer(br.readLine());}catch (IOException  e){e.printStackTrace();}}return st.nextToken();}
        int nextInt() {return Integer.parseInt(next());}
        long nextLong() {return Long.parseLong(next());}
        double nextDouble() {return Double.parseDouble(next());}
        char[][] readCharArray(int n, int m) {
        	String str;
        	char[][] arr = new char[n][m];
        	for(int i = 0; i < n; ++i) {
        		str=nextLine();
        		for(int j = 0;j < n; ++j) {
        			arr[i][j] = str.charAt(j);
        		}
        	}
        	return arr;
        }
        char[][] readCharArray(int n) {
        	return readCharArray(n,n);
        }
        int[] readArray(int n) {int[] a = new int[n]; for (int i = 0; i < n; ++i) a[i] = nextInt(); return a;}
        long[] readLongArray(int n) {long[] a=new long[n];for (int i = 0; i < n; ++i) a[i] = nextLong(); return a;}
        String nextLine() {String str = "";try{str = br.readLine();} catch (IOException e){e.printStackTrace();} return str;}
    }
    public static void main(String[] args) throws NumberFormatException, IOException {
        FastReader fs = new FastReader();
        PrintWriter out = new PrintWriter(System.out);
        int n = fs.nextInt();
        int ans = 0, cnt1 = -1;
        for (int i = 1; i <= n; ++i) {
            int temp = i;
            int cnt = 0;
            while (temp % 2 == 0) {
                temp /= 2;
                ++cnt;
            }
            if (cnt >= cnt1) {
                cnt1 = cnt;
                ans = i;
            }
        }
        out.println(ans);
        out.close();
    }

} public class Main {
    static class FastReader{
        BufferedReader br,br1;
        StringTokenizer st;
        public FastReader() {br = new BufferedReader(new InputStreamReader(System.in));}
        public FastReader(String fileName) throws FileNotFoundException{br = new BufferedReader(new FileReader(fileName));}
        String next() {while (st == null || !st.hasMoreElements()){try{st = new StringTokenizer(br.readLine());}catch (IOException  e){e.printStackTrace();}}return st.nextToken();}
        int nextInt() {return Integer.parseInt(next());}
        long nextLong() {return Long.parseLong(next());}
        double nextDouble() {return Double.parseDouble(next());}
        char[][] readCharArray(int n, int m) {
        	String str;
        	char[][] arr = new char[n][m];
        	for(int i = 0; i < n; ++i) {
        		str=nextLine();
        		for(int j = 0;j < n; ++j) {
        			arr[i][j] = str.charAt(j);
        		}
        	}
        	return arr;
        }
        char[][] readCharArray(int n) {
        	return readCharArray(n,n);
        }
        int[] readArray(int n) {int[] a = new int[n]; for (int i = 0; i < n; ++i) a[i] = nextInt(); return a;}
        long[] readLongArray(int n) {long[] a=new long[n];for (int i = 0; i < n; ++i) a[i] = nextLong(); return a;}
        String nextLine() {String str = "";try{str = br.readLine();} catch (IOException e){e.printStackTrace();} return str;}
    }
    public static void main(String[] args) throws NumberFormatException, IOException {
        FastReader fs = new FastReader();
        PrintWriter out = new PrintWriter(System.out);
        int n = fs.nextInt();
        int ans = 0, cnt1 = -1;
        for (int i = 1; i <= n; ++i) {
            int temp = i;
            int cnt = 0;
            while (temp % 2 == 0) {
                temp /= 2;
                ++cnt;
            }
            if (cnt >= cnt1) {
                cnt1 = cnt;
                ans = i;
            }
        }
        out.println(ans);
        out.close();
    }

} Main
import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class Main {
    static class FastReader{
        BufferedReader br,br1;
        StringTokenizer st;
        public FastReader() {br = new BufferedReader(new InputStreamReader(System.in));}
        public FastReader(String fileName) throws FileNotFoundException{br = new BufferedReader(new FileReader(fileName));}
        String next() {while (st == null || !st.hasMoreElements()){try{st = new StringTokenizer(br.readLine());}catch (IOException  e){e.printStackTrace();}}return st.nextToken();}
        int nextInt() {return Integer.parseInt(next());}
        long nextLong() {return Long.parseLong(next());}
        double nextDouble() {return Double.parseDouble(next());}
        char[][] readCharArray(int n, int m) {
        	String str;
        	char[][] arr = new char[n][m];
        	for(int i = 0; i < n; ++i) {
        		str=nextLine();
        		for(int j = 0;j < n; ++j) {
        			arr[i][j] = str.charAt(j);
        		}
        	}
        	return arr;
        }
        char[][] readCharArray(int n) {
        	return readCharArray(n,n);
        }
        int[] readArray(int n) {int[] a = new int[n]; for (int i = 0; i < n; ++i) a[i] = nextInt(); return a;}
        long[] readLongArray(int n) {long[] a=new long[n];for (int i = 0; i < n; ++i) a[i] = nextLong(); return a;}
        String nextLine() {String str = "";try{str = br.readLine();} catch (IOException e){e.printStackTrace();} return str;}
    }
    public static void main(String[] args) throws NumberFormatException, IOException {
        FastReader fs = new FastReader();
        PrintWriter out = new PrintWriter(System.out);
        int n = fs.nextInt();
        int ans = 0, cnt1 = -1;
        for (int i = 1; i <= n; ++i) {
            int temp = i;
            int cnt = 0;
            while (temp % 2 == 0) {
                temp /= 2;
                ++cnt;
            }
            if (cnt >= cnt1) {
                cnt1 = cnt;
                ans = i;
            }
        }
        out.println(ans);
        out.close();
    }

}