import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); long n = sc.nextLong(); long x = 1; for (int i = 0; i < 128; i++) { x *= 2; x %= n; } System.out.println(x); } }