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