using System; using static System.Console; using System.Linq; using System.Collections.Generic; 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; Init(s); var count = 0; for (var i = 0; i < n; ++i) { var a = Next(); if (a <= mid) ++count; } if (n / 2 < count) ok = mid; else ng = mid; } WriteLine(ok); } static void Init(uint seed) { x = seed; y = 1; z = 2; w = 3; } static uint x = 0; static uint y = 1; static uint z = 2; static uint w = 3; static uint Next() { uint t = x ^ (x << 11); x = y; y = z; z = w; w = w ^ (w >> 19) ^ t ^ (t >> 8); return w; } }