import java.util.Arrays;
import java.util.Scanner;
public class Test {
public static void main(String[] args) {
//输入一个数字N,把偶数位置的所有数更改为0。比如30,
// 二进制形式是11110,替换后是01010,则输出对应的十进制整数10。
// 最右边是第0位,从右向左依次为0位,1位等等。不考虑非法输入等特殊情况。
Scanner sc = new Scanner(System.in);
int num = sc.nextInt();
String str = "";
while (num > 0) {
str = num % 2+str;
num = num / 2;
}
char[] chars = str.toCharArray();
if(chars.length%2!=0) {
for (int i = 0; i < chars.length; i++) {
if (i % 2 == 0) {
chars[i] = '0';
}
}
}else{
for (int i = 0; i < chars.length; i++) {
if (i % 2 != 0) {
chars[i] = '0';
}
}
}
// String s = Arrays.toString(chars);
String s=new String(chars);
// System.out.println(s);
System.out.println(Integer.parseInt(s,2));
}
}