




from __future__ import annotations

def 			_SCREAMING_SNAKE_CASE			(							lowercase	:       int | str     ):


      '''simple docstring'''



      lowerCamelCase_		     =    str(SCREAMING_SNAKE_CASE_     )
      return n == n[::-1]

def 			_SCREAMING_SNAKE_CASE			(							lowercase	:       int = 1_00_00_00     ):


      '''simple docstring'''



      lowerCamelCase_		     =    0

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


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







"""simple docstring"""




def     lowercase			(SCREAMING_SNAKE_CASE_		:				int  )   ->						str:
						SCREAMING_SNAKE_CASE													=					int(SCREAMING_SNAKE_CASE_  )
						if decimal in (0, 1):  # Exit cases for the recursion
												return str(SCREAMING_SNAKE_CASE_  )
						SCREAMING_SNAKE_CASE							,				SCREAMING_SNAKE_CASE													=					divmod(SCREAMING_SNAKE_CASE_ ,			2  )
						return binary_recursive(SCREAMING_SNAKE_CASE_  ) + str(SCREAMING_SNAKE_CASE_  )


def     lowercase			(SCREAMING_SNAKE_CASE_		:				str  )   ->						str:
						SCREAMING_SNAKE_CASE													=					str(SCREAMING_SNAKE_CASE_  ).strip()
						if not number:
												raise ValueError('No input value was provided'  )
						SCREAMING_SNAKE_CASE													=					'-' if number.startswith('-'  ) else ''
						SCREAMING_SNAKE_CASE													=					number.lstrip('-'  )
						if not number.isnumeric():
												raise ValueError('Input value is not an integer'  )
						return F'{negative}0b{binary_recursive(int(SCREAMING_SNAKE_CASE_  )  )}'


if __name__ == "__main__":
	from doctest import testmod

	testmod()


