Problem:
Score : 200 points

Problem Statement

Takahashi loves numbers divisible by 2.

You are given a positive integer N. Among the integers between 1 and N (inclusive), find the one that can be divisible by 2 for the most number of times. The solution is always unique.

Here, the number of times an integer can be divisible by 2, is how many times the integer can be divided by 2 without remainder.

For example,

6 can be divided by 2 once: 6 -> 3.

8 can be divided by 2 three times: 8 -> 4 -> 2 -> 1.

3 can be divided by 2 zero times.

Constraints

1 ≤ N ≤ 100

Input

Input is given from Standard Input in the following format:

N

Output

Print the answer.

Sample Input 1

7

Sample Output 1

4

4 can be divided by 2 twice, which is the most number of times among 1, 2, ..., 7.

Sample Input 2

32

Sample Output 2

32

Sample Input 3

1

Sample Output 3

1

Sample Input 4

100

Sample Output 4

64

Solution in C# (Mono 4.6.2.0) (judge verdict: Accepted)

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using static System.Math;
using static CS_AtCoder.Utils;
using static CS_AtCoder.Scan;
//using static CS_AtCoder.Library;


namespace CS_AtCoder {
	using Li = List<int>;
	using LLi = List<List<int>>;

	class Program {
		static void Main(string[] args) {
			new Calc().Solve();
		}
	}
	public class Calc {
        Scan cin = new Scan();
		public void Solve() {
            int N = cin.ReadInt();
            int sec = 1;
            while (sec*2<=N) {
                sec *= 2;
            }
            sec.WL();
			return;
		}

	}

	public class Scan {
		public Scan() { }
		public int ReadInt() => int.Parse(Console.ReadLine());
		public int[] ReadInt(char separator) => Console.ReadLine().Split(separator).Select(int.Parse).ToArray();
		public double ReadDouble() => double.Parse(Console.ReadLine());
		public double[] ReadDouble(char separator) => Console.ReadLine().Split(separator).Select(double.Parse).ToArray();
		public long ReadLong() => long.Parse(Console.ReadLine());
		public long[] ReadLong(char separator) => Console.ReadLine().Split(separator).Select(long.Parse).ToArray();
		public string ReadLine() => Console.ReadLine();
		public string[] ReadLine(char separator) => Console.ReadLine().Split(separator).ToArray();
	}
	public static class Utils {
		public static string Docking<T>(this IEnumerable<T> collection,string separator="") {
			return string.Join(separator, collection);
		}
		public static void WL(this object obj) => Console.WriteLine(obj);
		public static void WL<T>(this IEnumerable<T> collection) {
			foreach (var item in collection) {
				item.WL();
			}
		}
		public static void REP(int n,Action<int> act) {
			for (int i = 0; i < n; i++) act(i);
		}
		public static long Mod(long x) => x % ((long)1e9 + 7);
		public static long ModPow(long x,long a) {long tmp = 1;	while (a!=0) {if (a%2==1) {	tmp = Mod(tmp * x);	}x = Mod(x * x);a /= 2;	}return tmp;}
		public static long DivMod(long x, long y) => (Mod(x * ModPow(y, (long)1e9 + 5)));
		public static int ManhattanDistance(int x1, int y1, int x2, int y2) => (Abs(x2 - x1) + Abs(y2 - y1));
	}
}