import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines from functools import lru_cache @lru_cache(None) def solve(N, x): if N == 0: if x == 0: return 1, 0 else: return 0, 0 c1, s1 = solve(N//2, x) c2, s2 = solve((N-1)//2, x-1) return c1 + c2, s1*2 + s2*2 + c2 N = 2 ** 31 - 1 x = int(read()) answer = solve(N, x) print(*answer)