

'''simple docstring'''

from __future__ import annotations





def    A_  ( snake_case ):
  SCREAMING_SNAKE_CASE:Optional[int]						      =					str(__snake_case )
  return n == n[::-1]





def    A_  ( snake_case = 1000000 ):
  SCREAMING_SNAKE_CASE:str						      =					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()))))









'''simple docstring'''

from ..utils import DummyObject, requires_backends





class 							_snake_case (       metaclass=_a						):
   _A       :     Any       =					['''torch''', '''torchsde''']
   def __init__( self			:      Any     ,*SCREAMING_SNAKE_CASE__			:      int     ,**SCREAMING_SNAKE_CASE__			:      Tuple							):
     requires_backends(self     ,["torch", "torchsde"]							)
   @classmethod
   def     __UpperCamelCase						( cls			:      Dict     ,*SCREAMING_SNAKE_CASE__			:      Dict     ,**SCREAMING_SNAKE_CASE__			:      Optional[Any]							):
     requires_backends(cls     ,["torch", "torchsde"]							)







   @classmethod
   def     __UpperCamelCase						( cls			:      List[str]     ,*SCREAMING_SNAKE_CASE__			:      int     ,**SCREAMING_SNAKE_CASE__			:      Optional[Any]							):
     requires_backends(cls     ,["torch", "torchsde"]							)






