import java.io.*;
import java.util.*;
class     Main    {
	public static void main(String[] args) 
	{
		InputReader in = new InputReader(System.in);
		PrintWriter w = new PrintWriter(System.out);
		Scanner sc = new Scanner(System.in);
		int n = in.nextInt();
		if(n==1)
			System.out.println("1");
		else
		{
			int count=1;
			while(count<=n)
			{
				count*=2;
			}
			if(count/2==n)
				System.out.println(n);
			else
				System.out.println(count/2);
		}
		//w.println(n);
		w.close();
		sc.close();
	}
	static class InputReader {
		private final InputStream stream;
		private final byte[] buf = new byte[8192];
		private int curChar, snumChars;
		public InputReader(InputStream st) {
			this.stream = st;
		}
		public int read() {
			if (snumChars == -1)
				throw new InputMismatchException();
			if (curChar >= snumChars) {
				curChar = 0;
				try {
					snumChars = stream.read(buf);
				} catch (IOException e) {
					throw new InputMismatchException();
				}
				if (snumChars <= 0)
					return -1;
			}
			return buf[curChar++];
		}
		
		public int nextInt() {
			int c = read();
			while (isSpaceChar(c)) {
				c = read();
			}
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = read();
			}
			int res = 0;
			do {
				res *= 10;
				res += c - '0';
				c = read();
			} while (!isSpaceChar(c));
			return res * sgn;
		}
		
		public long nextLong() {
			int c = read();
			while (isSpaceChar(c)) {
				c = read();
			}
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = read();
			}
			long res = 0;
			do {
				res *= 10;
				res += c - '0';
				c = read();
			} while (!isSpaceChar(c));
			return res * sgn;
		}
		
		public int[] nextIntArray(int n) {
			int a[] = new int[n];
			for (int i = 0; i < n; i++) {
				a[i] = nextInt();
			}
			return a;
		}
		
		public String readString() {
			int c = read();
			while (isSpaceChar(c)) {
				c = read();
			}
			StringBuilder res = new StringBuilder();
			do {
				res.appendCodePoint(c);
				c = read();
			} while (!isSpaceChar(c));
			return res.toString();
		}
		
		public String nextLine() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			StringBuilder res = new StringBuilder();
			do {
				res.appendCodePoint(c);
				c = read();
			} while (!isEndOfLine(c));
			return res.toString();
		}
		
		public boolean isSpaceChar(int c) {
			return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
		}
		
		private boolean isEndOfLine(int c) {
			return c == '\n' || c == '\r' || c == -1;
		}
		
	}
	
} import java.io.*; io.* java import java.util.*; util.* java class     Main    {
	public static void main(String[] args) 
	{
		InputReader in = new InputReader(System.in);
		PrintWriter w = new PrintWriter(System.out);
		Scanner sc = new Scanner(System.in);
		int n = in.nextInt();
		if(n==1)
			System.out.println("1");
		else
		{
			int count=1;
			while(count<=n)
			{
				count*=2;
			}
			if(count/2==n)
				System.out.println(n);
			else
				System.out.println(count/2);
		}
		//w.println(n);
		w.close();
		sc.close();
	}
	static class InputReader {
		private final InputStream stream;
		private final byte[] buf = new byte[8192];
		private int curChar, snumChars;
		public InputReader(InputStream st) {
			this.stream = st;
		}
		public int read() {
			if (snumChars == -1)
				throw new InputMismatchException();
			if (curChar >= snumChars) {
				curChar = 0;
				try {
					snumChars = stream.read(buf);
				} catch (IOException e) {
					throw new InputMismatchException();
				}
				if (snumChars <= 0)
					return -1;
			}
			return buf[curChar++];
		}
		
		public int nextInt() {
			int c = read();
			while (isSpaceChar(c)) {
				c = read();
			}
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = read();
			}
			int res = 0;
			do {
				res *= 10;
				res += c - '0';
				c = read();
			} while (!isSpaceChar(c));
			return res * sgn;
		}
		
		public long nextLong() {
			int c = read();
			while (isSpaceChar(c)) {
				c = read();
			}
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = read();
			}
			long res = 0;
			do {
				res *= 10;
				res += c - '0';
				c = read();
			} while (!isSpaceChar(c));
			return res * sgn;
		}
		
		public int[] nextIntArray(int n) {
			int a[] = new int[n];
			for (int i = 0; i < n; i++) {
				a[i] = nextInt();
			}
			return a;
		}
		
		public String readString() {
			int c = read();
			while (isSpaceChar(c)) {
				c = read();
			}
			StringBuilder res = new StringBuilder();
			do {
				res.appendCodePoint(c);
				c = read();
			} while (!isSpaceChar(c));
			return res.toString();
		}
		
		public String nextLine() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			StringBuilder res = new StringBuilder();
			do {
				res.appendCodePoint(c);
				c = read();
			} while (!isEndOfLine(c));
			return res.toString();
		}
		
		public boolean isSpaceChar(int c) {
			return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
		}
		
		private boolean isEndOfLine(int c) {
			return c == '\n' || c == '\r' || c == -1;
		}
		
	}
	
} Main public static void main(String[] args) 
	{
		InputReader in = new InputReader(System.in);
		PrintWriter w = new PrintWriter(System.out);
		Scanner sc = new Scanner(System.in);
		int n = in.nextInt();
		if(n==1)
			System.out.println("1");
		else
		{
			int count=1;
			while(count<=n)
			{
				count*=2;
			}
			if(count/2==n)
				System.out.println(n);
			else
				System.out.println(count/2);
		}
		//w.println(n);
		w.close();
		sc.close();
	} main {
		InputReader in = new InputReader(System.in);
		PrintWriter w = new PrintWriter(System.out);
		Scanner sc = new Scanner(System.in);
		int n = in.nextInt();
		if(n==1)
			System.out.println("1");
		else
		{
			int count=1;
			while(count<=n)
			{
				count*=2;
			}
			if(count/2==n)
				System.out.println(n);
			else
				System.out.println(count/2);
		}
		//w.println(n);
		w.close();
		sc.close();
	} InputReader in = new InputReader(System.in); in new InputReader(System.in) PrintWriter w = new PrintWriter(System.out); w new PrintWriter(System.out) Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = in.nextInt(); n in.nextInt() in.nextInt in if(n==1)
			System.out.println("1");
		else
		{
			int count=1;
			while(count<=n)
			{
				count*=2;
			}
			if(count/2==n)
				System.out.println(n);
			else
				System.out.println(count/2);
		} n==1 n 1 System.out.println("1") System.out.println System.out System System.out "1" {
			int count=1;
			while(count<=n)
			{
				count*=2;
			}
			if(count/2==n)
				System.out.println(n);
			else
				System.out.println(count/2);
		} int count=1; count 1 while(count<=n)
			{
				count*=2;
			} count<=n count n {
				count*=2;
			} count*=2 count 2 if(count/2==n)
				System.out.println(n);
			else
				System.out.println(count/2); count/2==n count/2 count 2 n System.out.println(n) System.out.println System.out System System.out n System.out.println(count/2) System.out.println System.out System System.out count/2 count 2 w.close() w.close w sc.close() sc.close sc String[] args args static class InputReader {
		private final InputStream stream;
		private final byte[] buf = new byte[8192];
		private int curChar, snumChars;
		public InputReader(InputStream st) {
			this.stream = st;
		}
		public int read() {
			if (snumChars == -1)
				throw new InputMismatchException();
			if (curChar >= snumChars) {
				curChar = 0;
				try {
					snumChars = stream.read(buf);
				} catch (IOException e) {
					throw new InputMismatchException();
				}
				if (snumChars <= 0)
					return -1;
			}
			return buf[curChar++];
		}
		
		public int nextInt() {
			int c = read();
			while (isSpaceChar(c)) {
				c = read();
			}
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = read();
			}
			int res = 0;
			do {
				res *= 10;
				res += c - '0';
				c = read();
			} while (!isSpaceChar(c));
			return res * sgn;
		}
		
		public long nextLong() {
			int c = read();
			while (isSpaceChar(c)) {
				c = read();
			}
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = read();
			}
			long res = 0;
			do {
				res *= 10;
				res += c - '0';
				c = read();
			} while (!isSpaceChar(c));
			return res * sgn;
		}
		
		public int[] nextIntArray(int n) {
			int a[] = new int[n];
			for (int i = 0; i < n; i++) {
				a[i] = nextInt();
			}
			return a;
		}
		
		public String readString() {
			int c = read();
			while (isSpaceChar(c)) {
				c = read();
			}
			StringBuilder res = new StringBuilder();
			do {
				res.appendCodePoint(c);
				c = read();
			} while (!isSpaceChar(c));
			return res.toString();
		}
		
		public String nextLine() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			StringBuilder res = new StringBuilder();
			do {
				res.appendCodePoint(c);
				c = read();
			} while (!isEndOfLine(c));
			return res.toString();
		}
		
		public boolean isSpaceChar(int c) {
			return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
		}
		
		private boolean isEndOfLine(int c) {
			return c == '\n' || c == '\r' || c == -1;
		}
		
	} InputReader private final InputStream stream; stream private final byte[] buf = new byte[8192]; buf new byte[8192] 8192 private int curChar curChar snumChars; snumChars public InputReader(InputStream st) {
			this.stream = st;
		} InputReader {
			this.stream = st;
		} this.stream = st this.stream this this.stream st InputStream st st public int read() {
			if (snumChars == -1)
				throw new InputMismatchException();
			if (curChar >= snumChars) {
				curChar = 0;
				try {
					snumChars = stream.read(buf);
				} catch (IOException e) {
					throw new InputMismatchException();
				}
				if (snumChars <= 0)
					return -1;
			}
			return buf[curChar++];
		} read {
			if (snumChars == -1)
				throw new InputMismatchException();
			if (curChar >= snumChars) {
				curChar = 0;
				try {
					snumChars = stream.read(buf);
				} catch (IOException e) {
					throw new InputMismatchException();
				}
				if (snumChars <= 0)
					return -1;
			}
			return buf[curChar++];
		} if (snumChars == -1)
				throw new InputMismatchException(); snumChars == -1 snumChars -1 1 throw new InputMismatchException(); new InputMismatchException() if (curChar >= snumChars) {
				curChar = 0;
				try {
					snumChars = stream.read(buf);
				} catch (IOException e) {
					throw new InputMismatchException();
				}
				if (snumChars <= 0)
					return -1;
			} curChar >= snumChars curChar snumChars {
				curChar = 0;
				try {
					snumChars = stream.read(buf);
				} catch (IOException e) {
					throw new InputMismatchException();
				}
				if (snumChars <= 0)
					return -1;
			} curChar = 0 curChar 0 try {
					snumChars = stream.read(buf);
				} catch (IOException e) {
					throw new InputMismatchException();
				} catch (IOException e) {
					throw new InputMismatchException();
				} IOException e {
					throw new InputMismatchException();
				} throw new InputMismatchException(); new InputMismatchException() {
					snumChars = stream.read(buf);
				} snumChars = stream.read(buf) snumChars stream.read(buf) stream.read stream buf if (snumChars <= 0)
					return -1; snumChars <= 0 snumChars 0 return -1; -1 1 return buf[curChar++]; buf[curChar++] buf curChar++ curChar public int nextInt() {
			int c = read();
			while (isSpaceChar(c)) {
				c = read();
			}
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = read();
			}
			int res = 0;
			do {
				res *= 10;
				res += c - '0';
				c = read();
			} while (!isSpaceChar(c));
			return res * sgn;
		} nextInt {
			int c = read();
			while (isSpaceChar(c)) {
				c = read();
			}
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = read();
			}
			int res = 0;
			do {
				res *= 10;
				res += c - '0';
				c = read();
			} while (!isSpaceChar(c));
			return res * sgn;
		} int c = read(); c read() read while (isSpaceChar(c)) {
				c = read();
			} isSpaceChar(c) isSpaceChar c {
				c = read();
			} c = read() c read() read int sgn = 1; sgn 1 if (c == '-') {
				sgn = -1;
				c = read();
			} c == '-' c '-' {
				sgn = -1;
				c = read();
			} sgn = -1 sgn -1 1 c = read() c read() read int res = 0; res 0 do {
				res *= 10;
				res += c - '0';
				c = read();
			} while (!isSpaceChar(c)); !isSpaceChar(c) isSpaceChar(c) isSpaceChar c {
				res *= 10;
				res += c - '0';
				c = read();
			} res *= 10 res 10 res += c - '0' res c - '0' c '0' c = read() c read() read return res * sgn; res * sgn res sgn public long nextLong() {
			int c = read();
			while (isSpaceChar(c)) {
				c = read();
			}
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = read();
			}
			long res = 0;
			do {
				res *= 10;
				res += c - '0';
				c = read();
			} while (!isSpaceChar(c));
			return res * sgn;
		} nextLong {
			int c = read();
			while (isSpaceChar(c)) {
				c = read();
			}
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = read();
			}
			long res = 0;
			do {
				res *= 10;
				res += c - '0';
				c = read();
			} while (!isSpaceChar(c));
			return res * sgn;
		} int c = read(); c read() read while (isSpaceChar(c)) {
				c = read();
			} isSpaceChar(c) isSpaceChar c {
				c = read();
			} c = read() c read() read int sgn = 1; sgn 1 if (c == '-') {
				sgn = -1;
				c = read();
			} c == '-' c '-' {
				sgn = -1;
				c = read();
			} sgn = -1 sgn -1 1 c = read() c read() read long res = 0; res 0 do {
				res *= 10;
				res += c - '0';
				c = read();
			} while (!isSpaceChar(c)); !isSpaceChar(c) isSpaceChar(c) isSpaceChar c {
				res *= 10;
				res += c - '0';
				c = read();
			} res *= 10 res 10 res += c - '0' res c - '0' c '0' c = read() c read() read return res * sgn; res * sgn res sgn public int[] nextIntArray(int n) {
			int a[] = new int[n];
			for (int i = 0; i < n; i++) {
				a[i] = nextInt();
			}
			return a;
		} nextIntArray {
			int a[] = new int[n];
			for (int i = 0; i < n; i++) {
				a[i] = nextInt();
			}
			return a;
		} int a[] = new int[n]; a new int[n] n for (int i = 0; i < n; i++) {
				a[i] = nextInt();
			} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
				a[i] = nextInt();
			} {
				a[i] = nextInt();
			} a[i] = nextInt() a[i] a i nextInt() nextInt return a; a int n n public String readString() {
			int c = read();
			while (isSpaceChar(c)) {
				c = read();
			}
			StringBuilder res = new StringBuilder();
			do {
				res.appendCodePoint(c);
				c = read();
			} while (!isSpaceChar(c));
			return res.toString();
		} readString {
			int c = read();
			while (isSpaceChar(c)) {
				c = read();
			}
			StringBuilder res = new StringBuilder();
			do {
				res.appendCodePoint(c);
				c = read();
			} while (!isSpaceChar(c));
			return res.toString();
		} int c = read(); c read() read while (isSpaceChar(c)) {
				c = read();
			} isSpaceChar(c) isSpaceChar c {
				c = read();
			} c = read() c read() read StringBuilder res = new StringBuilder(); res new StringBuilder() do {
				res.appendCodePoint(c);
				c = read();
			} while (!isSpaceChar(c)); !isSpaceChar(c) isSpaceChar(c) isSpaceChar c {
				res.appendCodePoint(c);
				c = read();
			} res.appendCodePoint(c) res.appendCodePoint res c c = read() c read() read return res.toString(); res.toString() res.toString res public String nextLine() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			StringBuilder res = new StringBuilder();
			do {
				res.appendCodePoint(c);
				c = read();
			} while (!isEndOfLine(c));
			return res.toString();
		} nextLine {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			StringBuilder res = new StringBuilder();
			do {
				res.appendCodePoint(c);
				c = read();
			} while (!isEndOfLine(c));
			return res.toString();
		} int c = read(); c read() read while (isSpaceChar(c))
				c = read(); isSpaceChar(c) isSpaceChar c c = read() c read() read StringBuilder res = new StringBuilder(); res new StringBuilder() do {
				res.appendCodePoint(c);
				c = read();
			} while (!isEndOfLine(c)); !isEndOfLine(c) isEndOfLine(c) isEndOfLine c {
				res.appendCodePoint(c);
				c = read();
			} res.appendCodePoint(c) res.appendCodePoint res c c = read() c read() read return res.toString(); res.toString() res.toString res public boolean isSpaceChar(int c) {
			return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
		} isSpaceChar {
			return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
		} return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1; c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1 c == '\t' c == '\r' c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1 c == ' ' c ' ' c == '\n' c '\n' c == '\r' c '\r' c == '\t' c '\t' c == -1 c -1 1 int c c private boolean isEndOfLine(int c) {
			return c == '\n' || c == '\r' || c == -1;
		} isEndOfLine {
			return c == '\n' || c == '\r' || c == -1;
		} return c == '\n' || c == '\r' || c == -1; c == '\n' || c == '\r' || c == -1 c == '\n' || c == '\r' || c == -1 c == '\n' c '\n' c == '\r' c '\r' c == -1 c -1 1 int c c
import java.io.*;
import java.util.*;
class     Main    {
	public static void main(String[] args) 
	{
		InputReader in = new InputReader(System.in);
		PrintWriter w = new PrintWriter(System.out);
		Scanner sc = new Scanner(System.in);
		int n = in.nextInt();
		if(n==1)
			System.out.println("1");
		else
		{
			int count=1;
			while(count<=n)
			{
				count*=2;
			}
			if(count/2==n)
				System.out.println(n);
			else
				System.out.println(count/2);
		}
		//w.println(n);
		w.close();
		sc.close();
	}
	static class InputReader {
		private final InputStream stream;
		private final byte[] buf = new byte[8192];
		private int curChar, snumChars;
		public InputReader(InputStream st) {
			this.stream = st;
		}
		public int read() {
			if (snumChars == -1)
				throw new InputMismatchException();
			if (curChar >= snumChars) {
				curChar = 0;
				try {
					snumChars = stream.read(buf);
				} catch (IOException e) {
					throw new InputMismatchException();
				}
				if (snumChars <= 0)
					return -1;
			}
			return buf[curChar++];
		}
		
		public int nextInt() {
			int c = read();
			while (isSpaceChar(c)) {
				c = read();
			}
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = read();
			}
			int res = 0;
			do {
				res *= 10;
				res += c - '0';
				c = read();
			} while (!isSpaceChar(c));
			return res * sgn;
		}
		
		public long nextLong() {
			int c = read();
			while (isSpaceChar(c)) {
				c = read();
			}
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = read();
			}
			long res = 0;
			do {
				res *= 10;
				res += c - '0';
				c = read();
			} while (!isSpaceChar(c));
			return res * sgn;
		}
		
		public int[] nextIntArray(int n) {
			int a[] = new int[n];
			for (int i = 0; i < n; i++) {
				a[i] = nextInt();
			}
			return a;
		}
		
		public String readString() {
			int c = read();
			while (isSpaceChar(c)) {
				c = read();
			}
			StringBuilder res = new StringBuilder();
			do {
				res.appendCodePoint(c);
				c = read();
			} while (!isSpaceChar(c));
			return res.toString();
		}
		
		public String nextLine() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			StringBuilder res = new StringBuilder();
			do {
				res.appendCodePoint(c);
				c = read();
			} while (!isEndOfLine(c));
			return res.toString();
		}
		
		public boolean isSpaceChar(int c) {
			return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
		}
		
		private boolean isEndOfLine(int c) {
			return c == '\n' || c == '\r' || c == -1;
		}
		
	}
	
}