import java.util.*; import java.io.*; // This file is a "Hello, world!" in Java language by OpenJDK for wandbox. class Main { public static void main(String[] args) { new Main().run(); } void run(){ Scanner sc=new Scanner(System.in); long m=sc.nextLong(); long ans=1; for(int i=0;i<128;++i)ans=2*ans%m; System.out.println(ans); } void tr(Object...o){System.out.println(Arrays.deepToString(o));} } // OpenJDK reference: // http://openjdk.java.net/ // Java language references: // http://docs.oracle.com/javase