import java.util.Scanner;
public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int givenNumber = scanner.nextInt();

        int dividedCount = 0;
        int currentDividedCount = 0;
        int tmp = 0;
        int output = 0;
        int target = 0;

        for(int i=givenNumber; i>0; i--) {
            if(givenNumber == 1) {
                output = 1;
                break;
            }
            if(i % 2 == 0) {
                target = i;
                tmp = i;
                while(true) {
                    if(target % 2 != 0) {
                        break;
                    } else {
                        dividedCount += 1;
                        target /= 2;
                    }
                }
                if(currentDividedCount < dividedCount) {
                    currentDividedCount = dividedCount;
                    output = tmp;
                }
                dividedCount = 0;
            }
        }
        System.out.println(output);
    }
} import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int givenNumber = scanner.nextInt();

        int dividedCount = 0;
        int currentDividedCount = 0;
        int tmp = 0;
        int output = 0;
        int target = 0;

        for(int i=givenNumber; i>0; i--) {
            if(givenNumber == 1) {
                output = 1;
                break;
            }
            if(i % 2 == 0) {
                target = i;
                tmp = i;
                while(true) {
                    if(target % 2 != 0) {
                        break;
                    } else {
                        dividedCount += 1;
                        target /= 2;
                    }
                }
                if(currentDividedCount < dividedCount) {
                    currentDividedCount = dividedCount;
                    output = tmp;
                }
                dividedCount = 0;
            }
        }
        System.out.println(output);
    }
} Main public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int givenNumber = scanner.nextInt();

        int dividedCount = 0;
        int currentDividedCount = 0;
        int tmp = 0;
        int output = 0;
        int target = 0;

        for(int i=givenNumber; i>0; i--) {
            if(givenNumber == 1) {
                output = 1;
                break;
            }
            if(i % 2 == 0) {
                target = i;
                tmp = i;
                while(true) {
                    if(target % 2 != 0) {
                        break;
                    } else {
                        dividedCount += 1;
                        target /= 2;
                    }
                }
                if(currentDividedCount < dividedCount) {
                    currentDividedCount = dividedCount;
                    output = tmp;
                }
                dividedCount = 0;
            }
        }
        System.out.println(output);
    } main {
        Scanner scanner = new Scanner(System.in);
        int givenNumber = scanner.nextInt();

        int dividedCount = 0;
        int currentDividedCount = 0;
        int tmp = 0;
        int output = 0;
        int target = 0;

        for(int i=givenNumber; i>0; i--) {
            if(givenNumber == 1) {
                output = 1;
                break;
            }
            if(i % 2 == 0) {
                target = i;
                tmp = i;
                while(true) {
                    if(target % 2 != 0) {
                        break;
                    } else {
                        dividedCount += 1;
                        target /= 2;
                    }
                }
                if(currentDividedCount < dividedCount) {
                    currentDividedCount = dividedCount;
                    output = tmp;
                }
                dividedCount = 0;
            }
        }
        System.out.println(output);
    } Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) int givenNumber = scanner.nextInt(); givenNumber scanner.nextInt() scanner.nextInt scanner int dividedCount = 0; dividedCount 0 int currentDividedCount = 0; currentDividedCount 0 int tmp = 0; tmp 0 int output = 0; output 0 int target = 0; target 0 for(int i=givenNumber; i>0; i--) {
            if(givenNumber == 1) {
                output = 1;
                break;
            }
            if(i % 2 == 0) {
                target = i;
                tmp = i;
                while(true) {
                    if(target % 2 != 0) {
                        break;
                    } else {
                        dividedCount += 1;
                        target /= 2;
                    }
                }
                if(currentDividedCount < dividedCount) {
                    currentDividedCount = dividedCount;
                    output = tmp;
                }
                dividedCount = 0;
            }
        } int i=givenNumber; int i=givenNumber; i givenNumber i>0 i 0 i-- i-- i {
            if(givenNumber == 1) {
                output = 1;
                break;
            }
            if(i % 2 == 0) {
                target = i;
                tmp = i;
                while(true) {
                    if(target % 2 != 0) {
                        break;
                    } else {
                        dividedCount += 1;
                        target /= 2;
                    }
                }
                if(currentDividedCount < dividedCount) {
                    currentDividedCount = dividedCount;
                    output = tmp;
                }
                dividedCount = 0;
            }
        } {
            if(givenNumber == 1) {
                output = 1;
                break;
            }
            if(i % 2 == 0) {
                target = i;
                tmp = i;
                while(true) {
                    if(target % 2 != 0) {
                        break;
                    } else {
                        dividedCount += 1;
                        target /= 2;
                    }
                }
                if(currentDividedCount < dividedCount) {
                    currentDividedCount = dividedCount;
                    output = tmp;
                }
                dividedCount = 0;
            }
        } if(givenNumber == 1) {
                output = 1;
                break;
            } givenNumber == 1 givenNumber 1 {
                output = 1;
                break;
            } output = 1 output 1 break; if(i % 2 == 0) {
                target = i;
                tmp = i;
                while(true) {
                    if(target % 2 != 0) {
                        break;
                    } else {
                        dividedCount += 1;
                        target /= 2;
                    }
                }
                if(currentDividedCount < dividedCount) {
                    currentDividedCount = dividedCount;
                    output = tmp;
                }
                dividedCount = 0;
            } i % 2 == 0 i % 2 i 2 0 {
                target = i;
                tmp = i;
                while(true) {
                    if(target % 2 != 0) {
                        break;
                    } else {
                        dividedCount += 1;
                        target /= 2;
                    }
                }
                if(currentDividedCount < dividedCount) {
                    currentDividedCount = dividedCount;
                    output = tmp;
                }
                dividedCount = 0;
            } target = i target i tmp = i tmp i while(true) {
                    if(target % 2 != 0) {
                        break;
                    } else {
                        dividedCount += 1;
                        target /= 2;
                    }
                } true {
                    if(target % 2 != 0) {
                        break;
                    } else {
                        dividedCount += 1;
                        target /= 2;
                    }
                } if(target % 2 != 0) {
                        break;
                    } else {
                        dividedCount += 1;
                        target /= 2;
                    } target % 2 != 0 target % 2 target 2 0 {
                        break;
                    } break; {
                        dividedCount += 1;
                        target /= 2;
                    } dividedCount += 1 dividedCount 1 target /= 2 target 2 if(currentDividedCount < dividedCount) {
                    currentDividedCount = dividedCount;
                    output = tmp;
                } currentDividedCount < dividedCount currentDividedCount dividedCount {
                    currentDividedCount = dividedCount;
                    output = tmp;
                } currentDividedCount = dividedCount currentDividedCount dividedCount output = tmp output tmp dividedCount = 0 dividedCount 0 System.out.println(output) System.out.println System.out System System.out output String[] args args public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int givenNumber = scanner.nextInt();

        int dividedCount = 0;
        int currentDividedCount = 0;
        int tmp = 0;
        int output = 0;
        int target = 0;

        for(int i=givenNumber; i>0; i--) {
            if(givenNumber == 1) {
                output = 1;
                break;
            }
            if(i % 2 == 0) {
                target = i;
                tmp = i;
                while(true) {
                    if(target % 2 != 0) {
                        break;
                    } else {
                        dividedCount += 1;
                        target /= 2;
                    }
                }
                if(currentDividedCount < dividedCount) {
                    currentDividedCount = dividedCount;
                    output = tmp;
                }
                dividedCount = 0;
            }
        }
        System.out.println(output);
    }
} public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int givenNumber = scanner.nextInt();

        int dividedCount = 0;
        int currentDividedCount = 0;
        int tmp = 0;
        int output = 0;
        int target = 0;

        for(int i=givenNumber; i>0; i--) {
            if(givenNumber == 1) {
                output = 1;
                break;
            }
            if(i % 2 == 0) {
                target = i;
                tmp = i;
                while(true) {
                    if(target % 2 != 0) {
                        break;
                    } else {
                        dividedCount += 1;
                        target /= 2;
                    }
                }
                if(currentDividedCount < dividedCount) {
                    currentDividedCount = dividedCount;
                    output = tmp;
                }
                dividedCount = 0;
            }
        }
        System.out.println(output);
    }
} Main
import java.util.Scanner;
public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int givenNumber = scanner.nextInt();

        int dividedCount = 0;
        int currentDividedCount = 0;
        int tmp = 0;
        int output = 0;
        int target = 0;

        for(int i=givenNumber; i>0; i--) {
            if(givenNumber == 1) {
                output = 1;
                break;
            }
            if(i % 2 == 0) {
                target = i;
                tmp = i;
                while(true) {
                    if(target % 2 != 0) {
                        break;
                    } else {
                        dividedCount += 1;
                        target /= 2;
                    }
                }
                if(currentDividedCount < dividedCount) {
                    currentDividedCount = dividedCount;
                    output = tmp;
                }
                dividedCount = 0;
            }
        }
        System.out.println(output);
    }
}
