using System; using static System.Console; class Program { static uint NN => uint.Parse(ReadLine()); public static void Main() { Solve(); } static void Solve() { var s = NN; var n = 10_000_001; var ok = 3_000_000_000L; var ng = 1_000_000_000L; while (ok - ng > 1) { var mid = (ok + ng) / 2; x = s; y = 1; z = 2; w = 3; var count = 0; for (var i = 0; i < n; ++i) { uint t = x ^ (x << 11); x = y; y = z; z = w; w = w ^ (w >> 19) ^ t ^ (t >> 8); if (w <= mid) ++count; } if (n / 2 < count) ok = mid; else ng = mid; } WriteLine(ok); } static uint x = 0; static uint y = 1; static uint z = 2; static uint w = 3; }