import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();

        if(n == 1) {
            System.out.println(1);
            System.exit(0);
        }

        int count = 0;
        int tmpCount = 0;
        int outputNum = 0;

        for(int i=n; i>0; i--) {
            if(i % 2 == 0) {
                int tmp = i;
                while(true) {
                    if(tmp % 2 == 0) {
                        tmp /= 2;
                        tmpCount++;
                    } else {
                        break;
                    }
                }
                if(count < tmpCount) {
                    outputNum = i;
                    count = tmpCount;
                }
            }
            tmpCount = 0;
        }
        System.out.println(outputNum);
    }
} 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();

        if(n == 1) {
            System.out.println(1);
            System.exit(0);
        }

        int count = 0;
        int tmpCount = 0;
        int outputNum = 0;

        for(int i=n; i>0; i--) {
            if(i % 2 == 0) {
                int tmp = i;
                while(true) {
                    if(tmp % 2 == 0) {
                        tmp /= 2;
                        tmpCount++;
                    } else {
                        break;
                    }
                }
                if(count < tmpCount) {
                    outputNum = i;
                    count = tmpCount;
                }
            }
            tmpCount = 0;
        }
        System.out.println(outputNum);
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();

        if(n == 1) {
            System.out.println(1);
            System.exit(0);
        }

        int count = 0;
        int tmpCount = 0;
        int outputNum = 0;

        for(int i=n; i>0; i--) {
            if(i % 2 == 0) {
                int tmp = i;
                while(true) {
                    if(tmp % 2 == 0) {
                        tmp /= 2;
                        tmpCount++;
                    } else {
                        break;
                    }
                }
                if(count < tmpCount) {
                    outputNum = i;
                    count = tmpCount;
                }
            }
            tmpCount = 0;
        }
        System.out.println(outputNum);
    } main {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();

        if(n == 1) {
            System.out.println(1);
            System.exit(0);
        }

        int count = 0;
        int tmpCount = 0;
        int outputNum = 0;

        for(int i=n; i>0; i--) {
            if(i % 2 == 0) {
                int tmp = i;
                while(true) {
                    if(tmp % 2 == 0) {
                        tmp /= 2;
                        tmpCount++;
                    } else {
                        break;
                    }
                }
                if(count < tmpCount) {
                    outputNum = i;
                    count = tmpCount;
                }
            }
            tmpCount = 0;
        }
        System.out.println(outputNum);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc if(n == 1) {
            System.out.println(1);
            System.exit(0);
        } n == 1 n 1 {
            System.out.println(1);
            System.exit(0);
        } System.out.println(1) System.out.println System.out System System.out 1 System.exit(0) System.exit System 0 int count = 0; count 0 int tmpCount = 0; tmpCount 0 int outputNum = 0; outputNum 0 for(int i=n; i>0; i--) {
            if(i % 2 == 0) {
                int tmp = i;
                while(true) {
                    if(tmp % 2 == 0) {
                        tmp /= 2;
                        tmpCount++;
                    } else {
                        break;
                    }
                }
                if(count < tmpCount) {
                    outputNum = i;
                    count = tmpCount;
                }
            }
            tmpCount = 0;
        } int i=n; int i=n; i n i>0 i 0 i-- i-- i {
            if(i % 2 == 0) {
                int tmp = i;
                while(true) {
                    if(tmp % 2 == 0) {
                        tmp /= 2;
                        tmpCount++;
                    } else {
                        break;
                    }
                }
                if(count < tmpCount) {
                    outputNum = i;
                    count = tmpCount;
                }
            }
            tmpCount = 0;
        } {
            if(i % 2 == 0) {
                int tmp = i;
                while(true) {
                    if(tmp % 2 == 0) {
                        tmp /= 2;
                        tmpCount++;
                    } else {
                        break;
                    }
                }
                if(count < tmpCount) {
                    outputNum = i;
                    count = tmpCount;
                }
            }
            tmpCount = 0;
        } if(i % 2 == 0) {
                int tmp = i;
                while(true) {
                    if(tmp % 2 == 0) {
                        tmp /= 2;
                        tmpCount++;
                    } else {
                        break;
                    }
                }
                if(count < tmpCount) {
                    outputNum = i;
                    count = tmpCount;
                }
            } i % 2 == 0 i % 2 i 2 0 {
                int tmp = i;
                while(true) {
                    if(tmp % 2 == 0) {
                        tmp /= 2;
                        tmpCount++;
                    } else {
                        break;
                    }
                }
                if(count < tmpCount) {
                    outputNum = i;
                    count = tmpCount;
                }
            } int tmp = i; tmp i while(true) {
                    if(tmp % 2 == 0) {
                        tmp /= 2;
                        tmpCount++;
                    } else {
                        break;
                    }
                } true {
                    if(tmp % 2 == 0) {
                        tmp /= 2;
                        tmpCount++;
                    } else {
                        break;
                    }
                } if(tmp % 2 == 0) {
                        tmp /= 2;
                        tmpCount++;
                    } else {
                        break;
                    } tmp % 2 == 0 tmp % 2 tmp 2 0 {
                        tmp /= 2;
                        tmpCount++;
                    } tmp /= 2 tmp 2 tmpCount++ tmpCount {
                        break;
                    } break; if(count < tmpCount) {
                    outputNum = i;
                    count = tmpCount;
                } count < tmpCount count tmpCount {
                    outputNum = i;
                    count = tmpCount;
                } outputNum = i outputNum i count = tmpCount count tmpCount tmpCount = 0 tmpCount 0 System.out.println(outputNum) System.out.println System.out System System.out outputNum String[] args args public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();

        if(n == 1) {
            System.out.println(1);
            System.exit(0);
        }

        int count = 0;
        int tmpCount = 0;
        int outputNum = 0;

        for(int i=n; i>0; i--) {
            if(i % 2 == 0) {
                int tmp = i;
                while(true) {
                    if(tmp % 2 == 0) {
                        tmp /= 2;
                        tmpCount++;
                    } else {
                        break;
                    }
                }
                if(count < tmpCount) {
                    outputNum = i;
                    count = tmpCount;
                }
            }
            tmpCount = 0;
        }
        System.out.println(outputNum);
    }
} public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();

        if(n == 1) {
            System.out.println(1);
            System.exit(0);
        }

        int count = 0;
        int tmpCount = 0;
        int outputNum = 0;

        for(int i=n; i>0; i--) {
            if(i % 2 == 0) {
                int tmp = i;
                while(true) {
                    if(tmp % 2 == 0) {
                        tmp /= 2;
                        tmpCount++;
                    } else {
                        break;
                    }
                }
                if(count < tmpCount) {
                    outputNum = i;
                    count = tmpCount;
                }
            }
            tmpCount = 0;
        }
        System.out.println(outputNum);
    }
} Main
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();

        if(n == 1) {
            System.out.println(1);
            System.exit(0);
        }

        int count = 0;
        int tmpCount = 0;
        int outputNum = 0;

        for(int i=n; i>0; i--) {
            if(i % 2 == 0) {
                int tmp = i;
                while(true) {
                    if(tmp % 2 == 0) {
                        tmp /= 2;
                        tmpCount++;
                    } else {
                        break;
                    }
                }
                if(count < tmpCount) {
                    outputNum = i;
                    count = tmpCount;
                }
            }
            tmpCount = 0;
        }
        System.out.println(outputNum);
    }
}
