#include using namespace std; template class Array : public vector { public: using vector::vector; using vector::begin; using vector::end; using vector::push_back; template Array map(function f) { Array res(end() - begin()); for (auto it = begin(); it != end(); ++it) res[it - begin()] = f(*it); return res; } Array select(function f) { Array res; for (auto it = begin(); it != end(); ++it) if (f(*it)) res.push_back(*it); return res; } template R reduce(R u, function f) { for (auto it = begin(); it != end(); ++it) u = f(u, *it); return u; } template Array> zip(const Array &b) { assert(end() - begin() == b.end() - b.begin()); Array> res; for (auto it = begin(); it != end(); ++it) res.push_back({*it, b[it - begin()]}); return res; } Array iota(T st) { Array res(end() - begin()); ::iota(res.begin(), res.end(), st); return res; } }; signed main() { ios::sync_with_stdio(false); int seed; cin >> seed; struct Rng { uint32_t x, y, z, w; Rng(int seed) : x(seed), y(1), z(2), w(3) {} uint32_t generate() { uint32_t t = (x ^ (x << 11)); x = y; y = z; z = w; w = (w ^ (w >> 19)) ^ (t ^ (t >> 8)); return w; } }; const int N = 10000001; uint64_t lb = 0, ub = 1ULL << 32; while (ub - lb > 1) { Rng rng(seed); uint64_t mb = lb + ub >> 1; int lcnt = 0; for (int i = 0; i < N; ++i) lcnt += rng.generate() < mb; (lcnt * 2 < N ? lb : ub) = mb; } cout << lb << endl; return 0; }