#include using namespace std; #define rep(i,n) for(long long i = 0; i < (long long)(n); i++) #define all(x) (x).begin(), (x).end() template bool chmin(T1 &a, T2 b) { return b < a && (a = b, true); } template bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); } using ll = int64_t; #define ldout fixed << setprecision(40) const int N = 1000001; uint32_t x = 0, y = 1, z = 2, w = 3; uint32_t t = 0; uint32_t generate() { t = (x^(x<<11)); x = y; y = z; z = w; w = (w ^ (w >> 19)) ^ (t ^ (t >> 8)); return w; } int32_t seed; uint32_t a[N]; int main(void) { cin >> seed; assert(1<=seed&&seed<=100000); x = seed; rep(i, N) a[i] = generate(); sort(a, a+N); cout << a[N/2] << endl; return 0; }