Go: package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	for scanner.Scan() {
		line := scanner.Text()
		n, _ := strconv.Atoi(line)

		var p2 = 1
		for {
			if n < 2*p2 {
				break
			}
			p2 *= 2
		}

		fmt.Printf("%v\n", p2)
	}
}

C++: /*
このコード、と～おれ!
Be accepted!
∧＿∧　
（｡･ω･｡)つ━☆・*。
⊂　　 ノ 　　　・゜+.
　しーＪ　　　°。+ *´¨)
 　　　　　　　　　.· ´¸.·*´¨) ¸.·*¨)
		  　　　　　　　　　　(¸.·´ (¸.·'* ☆
*/

#include <cstdio>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstring>
#include <vector>
#include <numeric>
#include <iostream>
#include <random>
#include <map>
#include <unordered_map>
#include <queue>
#include <regex>
#include <functional>
#include <complex>
#include <list>
#include <cassert>
#include <iomanip>
#include <set>
#include <stack>
#include <bitset>

////多倍長整数, cpp_intで宣言
//#include <boost/multiprecision/cpp_int.hpp>
//using namespace boost::multiprecision;

//#pragma gcc target ("avx2")
//#pragma gcc optimization ("Ofast")
//#pragma gcc optimization ("unroll-loops")
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define rep1(i, n) for(int i = 1; i <= (n); ++i)
#define rep2(i, n) for(int i = 2; i < (n); ++i)
#define repr(i, n) for(int i = n; i >= 0; --i)
#define reprm(i, n) for(int i = n - 1; i >= 0; --i)
#define printynl(a) printf(a ? "yes\n" : "no\n")
#define printyn(a) printf(a ? "Yes\n" : "No\n")
#define printYN(a) printf(a ? "YES\n" : "NO\n")
#define printim(a) printf(a ? "possible\n" : "imposible\n")
#define printdb(a) printf("%.50lf\n", a) //少数出力
#define printLdb(a) printf("%.50Lf\n", a) //少数出力
#define printdbd(a) printf("%.16lf\n", a) //少数出力(桁少なめ)
#define prints(s) printf("%s\n", s.c_str()) //string出力
#define all(x) (x).begin(), (x).end()
#define allsum(a, b, c) ((a + b) * c / 2LL) //等差数列の和、初項,末項,項数
#define pb push_back
#define rpriq priq<int, vector<int>, greater<int>>
#define deg_to_rad(deg) (((deg)/360.0L)*2.0L*PI)
#define rad_to_deg(rad) (((rad)/2.0L/PI)*360.0L)
#define Please return
#define AC 0
#define manhattan_dist(a, b, c, d) (abs(a - c) + abs(b - d)) /*(a, b) から (c, d) のマンハッタン距離 */
#define inf numeric_limits<double>::infinity();
#define linf numeric_limits<long double>::infinity()

using ll = long long;

constexpr int INF = 1073741823;
constexpr int MINF = -1073741823;
constexpr ll LINF = ll(4661686018427387903);
constexpr ll MOD = 1e9 + 7;
constexpr long double eps = 1e-6;
const long double PI = acosl(-1.0L);

using namespace std;

void scans(string& str) {
	char c;
	str = "";
	scanf("%c", &c);
	if (c == '\n')scanf("%c", &c);
	while (c != '\n' && c != -1 && c != ' ') {
		str += c;
		scanf("%c", &c);
	}
}

void scanc(char& str) {
	char c;
	scanf("%c", &c);
	if (c == -1)return;
	while (c == '\n') {
		scanf("%c", &c);
	}
	str = c;
}

double acot(double x) {
	return PI / 2 - atan(x);
}

ll LSB(ll n) { return (n & (-n)); }

/*-----------------------------------------ここからコード-----------------------------------------*/



int main() {

	int n;
	scanf("%d", &n);
	while ((n & (n - 1)) != 0)--n;
	printf("%d\n", n);

	Please AC;
}

C++: #include<bits/stdc++.h>
#define ll long long

using namespace std;

int main(){
	ll d, k=1;
	
	cin>>d;
	
	while(d>=2){
		d=d/2;
		k=k*2;
	}
	
	cout<<k<<"\n";
}

C++: #include <iostream>
#include <string>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <vector>
#include <cmath>
#include <cstdlib>
#include <queue>
#include <stack>
#include <iomanip>


using namespace std;

#define REP(i, n) for(ll i = 0;i < n;i++)
#define REPR(i, n) for(ll i = n;i >= 0;i--)
#define FOR(i, m, n) for(ll i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define REPO(i, n) for(ll i = 1;i <= n;i++)
#define ll long long
#define INF (ll)1 << 60
#define MINF (-1 * INF)
#define ALL(n) n.begin(),n.end()
#define MOD (ll)1000000007
#define P pair<ll, ll>

ll n, ans = 1;
int main() {
	cin >> n;
	while (ans * 2 <= n) {
		ans *= 2;
	}
	cout << ans << endl;
}

C++: #include<bits/stdc++.h>
using namespace std;
typedef long long ll;

int main(){
	int n;
	cin>>n;
	int a=1;
	while(true){
		if(a*2>n){
			break;
		}
		a*=2;
		
	}
	cout<<a<<endl;
}

C++: #include<iostream>
using namespace std;
int main(){
  int n,a=1;
  cin >> n;
  while(n>=a*2){
    a*=2;
  }
  cout << a << endl;
  
}

C++: #include<iostream>
using namespace std;
int main(){
	int N,ans=2,hanndann=2;
	cin >> N;
	while (1){
		hanndann *= 2;
		if (hanndann > N){
			break;
		}
		ans = hanndann;
	}
	cout << ans << endl;

	return 0;
}

C++: // 2020/07/13 Tazoe

#include <iostream>
using namespace std;

int main()
{
	int N;
	cin >> N;

	int M = 1;		// 現在の値
	while(M*2<=N){		// Nを超えないならば
		M *= 2;
	}

	cout << M << endl;

	return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;

int main(){
    int n;
    cin >> n;
    int count=1;
    int ans=0;
    int check=1;
    while(check!=0){
        count *=2;
        if(count>n){
            ans=count/2;
            check=0;
        } 
    }
    cout << ans << endl;
}

C++: #include <iostream>

int log2recursively(int i, int tmp) {
  int r = i / 2;

  if (r == 0) {
    return tmp;
  } else {
    return log2recursively(r, tmp * 2);
  }
}

int main() {
  int n;

  std::cin >> n;
  std::cout << log2recursively(n, 1) << std::endl;

  return 0;
}

C++: #include<iostream>
using namespace std;

int main(){
    int N;
    int homuzu=2;

    cin >> N;

    while(N>=homuzu){
        homuzu = homuzu*2;
    }

    cout << homuzu/2 << endl;

    return 0;
}

C++: #include<bits/stdc++.h>
using namespace std;
int main(void){
    int n,ans=0;
    cin>>n;
    int i=1;
    while(i*2<=n){
        i*=2;
        ans=i;
    }
    cout<<ans<<endl;
    return 0;
}

C++: #include<iostream>
using namespace std;
int main() {
	int n;
	cin >> n;
	int a=0, b;
	int cnt = 0;
	while (n/2!=0) n /= 2,cnt++;
	a = n % 2;
	if (a != 0)cnt++;
	int ans = 1;
	for (int i = 1;i < cnt;i++)ans *= 2;
	cout << ans << endl;
	return 0;
}

C++: #include <bits/stdc++.h>

typedef long long ll;
#define ALL(a) a, a+sizeof(a)/sizeof(a[0])
#define all(a) a.begin(),a.end()
#define MOD 1000000007
using namespace std;
ll gcd(ll n, ll m) {
	if (m == 0) return n;
	return gcd(m, n % m);
}
ll lcm(ll n, ll m) {return m / gcd(n, m) * n;}

int main(void) {
	ll n;
	cin >> n;
	int num = 1;
	while (num <= n) {
		num *= 2;
	}
	cout << num / 2 << endl;
	return 0;
}

C++: #include <iostream>
#include <cmath>
using namespace std;

int main(){
    long int a;
    cin >>a;
    long int p=1;

    for(int i=0;i<=20;i++){
        if(p>a){
            cout<<p/2<<endl;
            break;
        }
        p=p*2;
    }
    return 0;
}

C++: #include<bits/stdc++.h>

using namespace std;

main(){
	int a;
	int b=1;
	int c;
	cin >> a;
	while (b <= a){
		b=b*2;
	}
	printf("%d\n",b/2);
}

C++: #include <bits/stdc++.h>
using namespace std;

int main(){
    int n;
    cin >> n;

    for(int i=2;;i++){
        if(pow(2,i)>n){
            cout << pow(2,i-1) << endl;
            return 0;
        }
    }
}

C++: #include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
#define all(x) (x).begin(),(x).end()
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define REP(i, m, n) for(int i = m; i < n; i++)
#define INF INT_MAX
#define MOD 1000000007
#define fcout cout << fixed << setprecision(15)
typedef long long ll;
typedef pair<int, int> P;
int gcd(int a,int b){return b?gcd(b,a%b):a;};
int lcm(int a,int b){return a * b / gcd(a, b);};
int mod(int a,int b){return (a+b-1)/b;};
int month[12] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
template<class T>inline bool chmax(T& a,T b){if(a < b){a=b;return true;}return false;};
template<class T>inline bool chmin(T& a,T b){if(a > b){a=b;return true;}return false;};



int main() {
  cin.tie(0);
  cout.tie(0);
  ios::sync_with_stdio(false);

  int n;
  cin >> n;
  int t = 1;
  while(true) {
    if(t > n) {
      cout << t / 2 << endl;
      break;
    }
    t *= 2;
  }
  return 0;
}