import bisect def main(seed): digits = [] x, y, z, w = seed, 1, 2, 3 for _ in range(1000001): t = x ^ (x << 11) x, y, z = y, z, w w = (w ^ (w >> 19)) ^ (t ^ (t >> 8)) print(w) bisect.insort(digits, w) print(digits[500000]) if __name__ == '__main__': seed = int(input()) main(seed)