





from __future__ import annotations

def 							SCREAMING_SNAKE_CASE__       (  snake_case__  :int | str     )      ->						bool:
  _lowercase							= str(snake_case__     )
  return n == n[::-1]

def 							SCREAMING_SNAKE_CASE__       (  snake_case__  :int = 100_0000     )      ->						Any:
  _lowercase							= 0

  for i in range(1			,							snake_case__     ):
    if is_palindrome(snake_case__     ) and is_palindrome(bin(snake_case__     ).split('b'     )[1]     ):
      total += i
  return total


if __name__ == "__main__":
      print(solution(int(str(input().strip()))))






# NOTE: This file is deprecated and will be removed in a future version.
# It only exists so that temporarely `from diffusers.pipelines import DiffusionPipeline` works

from ...utils import deprecate
from ..controlnet.pipeline_flax_controlnet import FlaxStableDiffusionControlNetPipeline  # noqa: F401


deprecate(
    """stable diffusion controlnet""",
    """0.22.0""",
    """Importing `FlaxStableDiffusionControlNetPipeline` from diffusers.pipelines.stable_diffusion.flax_pipeline_stable_diffusion_controlnet is deprecated. Please import `from diffusers import FlaxStableDiffusionControlNetPipeline` instead.""",
    standard_warn=False,
    stacklevel=3,
)