using System; using System.Collections.Generic; using System.Linq; using System.IO; using System.Threading; using static util; class Program { static void Main(string[] args) { var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false }; var solver = new Solver(sw); // var t = new Thread(solver.solve, 1 << 26); // 64 MB // t.Start(); // t.Join(); solver.solve(); sw.Flush(); } } class Solver { StreamWriter sw; // Scan sc; void Prt(string a) => sw.WriteLine(a); void Prt(IEnumerable a) => Prt(string.Join(" ", a)); void Prt(params object[] a) => Prt(string.Join(" ", a)); public Solver(StreamWriter sw) { this.sw = sw; // this.sc = new Scan(); } public void solve() { long m = long.Parse(Console.ReadLine()); Assert(1 <= m && m < 1L << 60); long ans = 1; for (int i = 0; i < 128; i++) ans = ans * 2 % m; Prt(ans); } } static class util { public static void Assert(params bool[] conds) { foreach (var cond in conds) if (!cond) throw new Exception(); } }