import java.util.*;
import java.io.*;
public class Problem2 {

	static long[] powers;
	/**
	 * @param args
	 */
	public static void main(String[] args)throws Exception  {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner ( new FileReader ( "DATA2.txt" ) );
		PrintWriter pw = new PrintWriter ( new FileWriter ( "OUT2.txt" ) );
		
		powers = new long[17];
		
		for ( int i = 0; i < 17; i++ ){
			powers[i] = (long)Math.pow(2, i);
		}
		
		for ( int i = 0; i < 5; i++ ) {
			int e = Integer.parseInt(sc.nextLine().trim());
			
			long[] diff = new long[17];
			for ( int a = 0; a < powers.length; a++ ) {
				diff[a] = powers[a] - e;
			}
			
			long up = 0;
			long down = -100;
			
			for ( int a = 0; a < 17; a++ ){
				if ( diff[a] >= 0 ) {
					if ( a-1 >= 0 )
						down = powers[a-1];
					up = powers[a];
					break;
				}
			}
			
			if ( ( up - e ) <= ( e - down ) ) {
				pw.println(up);
			} else {
				pw.println(down);
			}
			pw.flush();
		}
		
		pw.close();
		sc.close();
	}

}

