#include using namespace std; uint32_t x = 0, 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; } int main(void) { int64_t seed; cin >> seed; x = seed; uint32_t v; int d = 5000000; int low = (1<<31)-d; uint32_t a[5000001]; int cnt = 0; for (int i = 0; i < 10000001; i++) { v = generate(); if (v < low) cnt += 1; else if (v < (low+d)) a[v-low] += 1; } int half = 5000000; //cout << cnt << endl; for (int i = 0; i < d; i++) { cnt += a[i]; if (cnt > half){ cout << i+low << endl; break; } } return 0; }