#include<stdio.h>
int main()
{
	int N;int i=2;
	scanf("%d",&N);
	do
	{
		i*=2;
	}
	while(i<N);
	while(N%2==0&&N!=1)
	{
		N=N/2;
	}
	if(N==1)
	{printf("%d",i);
	}
	else{printf("%d",i/2);
	}
	
	return 0;
}

