시간 제한메모리 제한제출정답맞힌 사람정답 비율
2 초 128 MB42581639126139.829%

문제

어떤 자연수 N을 2의 멱수의 합으로 나타내는 경우의 수를 구하는 프로그램을 작성하시오. 2의 멱수라는 것은, 2^k으로 표현되는 자연수를 의미한다.

예를 들어 7을 2의 멱수의 합으로 나타내는 경우의 수는 다음의 여섯 가지가 있다.

  1. 1+1+1+1+1+1+1
  2. 1+1+1+1+1+2
  3. 1+1+1+2+2
  4. 1+1+1+4
  5. 1+2+2+2
  6. 1+2+4

입력

첫째 줄에 N(1 ≤ N ≤ 1,000,000)이 주어진다.

출력

첫째 줄에 경우의 수를 출력한다. 답이 커질 수 있으므로 1,000,000,000으로 나눈 나머지를 출력한다.

예제 입력 1

7

예제 출력 1

6
W3sicHJvYmxlbV9pZCI6IjI0MTAiLCJwcm9ibGVtX2xhbmciOiIwIiwidGl0bGUiOiIyXHVjNzU4IFx1YmE3MVx1YzIxOFx1Yzc1OCBcdWQ1NjkiLCJkZXNjcmlwdGlvbiI6IjxwPlx1YzViNFx1YjVhNCBcdWM3OTBcdWM1ZjBcdWMyMTggTlx1Yzc0NCAyXHVjNzU4IFx1YmE3MVx1YzIxOFx1Yzc1OCBcdWQ1NjlcdWM3M2NcdWI4NWMgXHViMDk4XHVkMGMwXHViMGI0XHViMjk0IFx1YWNiZFx1YzZiMFx1Yzc1OCBcdWMyMThcdWI5N2MgXHVhZDZjXHVkNTU4XHViMjk0IFx1ZDUwNFx1Yjg1Y1x1YWRmOFx1YjdhOFx1Yzc0NCBcdWM3OTFcdWMxMzFcdWQ1NThcdWMyZGNcdWM2MjQuIDJcdWM3NTggXHViYTcxXHVjMjE4XHViNzdjXHViMjk0IFx1YWM4M1x1Yzc0MCwgMl5rXHVjNzNjXHViODVjIFx1ZDQ1Y1x1ZDYwNFx1YjQxOFx1YjI5NCBcdWM3OTBcdWM1ZjBcdWMyMThcdWI5N2MgXHVjNzU4XHViYmY4XHVkNTVjXHViMmU0LjxcL3A+XHJcblxyXG48c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