import java.io.IOException;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) throws IOException 
    {
        Scanner input = new Scanner(System.in);
        
        int n = input.nextInt();
        
        int maxCount = 0;
        int highest = 0;
        for (int i = 1; i <= n; i++)
        {
            int copy = i;
            int count = 0;
            while (copy % 2 == 0)
            {
                count++;
                copy /= 2;
            }
            if (count >= maxCount)
            {
                maxCount = count;
                highest = i;
            }
        }
        System.out.println(highest);
    } 
} import java.io.IOException; IOException java.io import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String[] args) throws IOException 
    {
        Scanner input = new Scanner(System.in);
        
        int n = input.nextInt();
        
        int maxCount = 0;
        int highest = 0;
        for (int i = 1; i <= n; i++)
        {
            int copy = i;
            int count = 0;
            while (copy % 2 == 0)
            {
                count++;
                copy /= 2;
            }
            if (count >= maxCount)
            {
                maxCount = count;
                highest = i;
            }
        }
        System.out.println(highest);
    } 
} Main public static void main(String[] args) throws IOException 
    {
        Scanner input = new Scanner(System.in);
        
        int n = input.nextInt();
        
        int maxCount = 0;
        int highest = 0;
        for (int i = 1; i <= n; i++)
        {
            int copy = i;
            int count = 0;
            while (copy % 2 == 0)
            {
                count++;
                copy /= 2;
            }
            if (count >= maxCount)
            {
                maxCount = count;
                highest = i;
            }
        }
        System.out.println(highest);
    } main {
        Scanner input = new Scanner(System.in);
        
        int n = input.nextInt();
        
        int maxCount = 0;
        int highest = 0;
        for (int i = 1; i <= n; i++)
        {
            int copy = i;
            int count = 0;
            while (copy % 2 == 0)
            {
                count++;
                copy /= 2;
            }
            if (count >= maxCount)
            {
                maxCount = count;
                highest = i;
            }
        }
        System.out.println(highest);
    } Scanner input = new Scanner(System.in); input new Scanner(System.in) int n = input.nextInt(); n input.nextInt() input.nextInt input int maxCount = 0; maxCount 0 int highest = 0; highest 0 for (int i = 1; i <= n; i++)
        {
            int copy = i;
            int count = 0;
            while (copy % 2 == 0)
            {
                count++;
                copy /= 2;
            }
            if (count >= maxCount)
            {
                maxCount = count;
                highest = i;
            }
        } int i = 1; int i = 1; i 1 i <= n i n i++ i++ i {
            int copy = i;
            int count = 0;
            while (copy % 2 == 0)
            {
                count++;
                copy /= 2;
            }
            if (count >= maxCount)
            {
                maxCount = count;
                highest = i;
            }
        } {
            int copy = i;
            int count = 0;
            while (copy % 2 == 0)
            {
                count++;
                copy /= 2;
            }
            if (count >= maxCount)
            {
                maxCount = count;
                highest = i;
            }
        } int copy = i; copy i int count = 0; count 0 while (copy % 2 == 0)
            {
                count++;
                copy /= 2;
            } copy % 2 == 0 copy % 2 copy 2 0 {
                count++;
                copy /= 2;
            } count++ count copy /= 2 copy 2 if (count >= maxCount)
            {
                maxCount = count;
                highest = i;
            } count >= maxCount count maxCount {
                maxCount = count;
                highest = i;
            } maxCount = count maxCount count highest = i highest i System.out.println(highest) System.out.println System.out System System.out highest String[] args args public class Main {
    public static void main(String[] args) throws IOException 
    {
        Scanner input = new Scanner(System.in);
        
        int n = input.nextInt();
        
        int maxCount = 0;
        int highest = 0;
        for (int i = 1; i <= n; i++)
        {
            int copy = i;
            int count = 0;
            while (copy % 2 == 0)
            {
                count++;
                copy /= 2;
            }
            if (count >= maxCount)
            {
                maxCount = count;
                highest = i;
            }
        }
        System.out.println(highest);
    } 
} public class Main {
    public static void main(String[] args) throws IOException 
    {
        Scanner input = new Scanner(System.in);
        
        int n = input.nextInt();
        
        int maxCount = 0;
        int highest = 0;
        for (int i = 1; i <= n; i++)
        {
            int copy = i;
            int count = 0;
            while (copy % 2 == 0)
            {
                count++;
                copy /= 2;
            }
            if (count >= maxCount)
            {
                maxCount = count;
                highest = i;
            }
        }
        System.out.println(highest);
    } 
} Main
import java.io.IOException;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) throws IOException 
    {
        Scanner input = new Scanner(System.in);
        
        int n = input.nextInt();
        
        int maxCount = 0;
        int highest = 0;
        for (int i = 1; i <= n; i++)
        {
            int copy = i;
            int count = 0;
            while (copy % 2 == 0)
            {
                count++;
                copy /= 2;
            }
            if (count >= maxCount)
            {
                maxCount = count;
                highest = i;
            }
        }
        System.out.println(highest);
    } 
}