



from __future__ import annotations

def 	SCREAMING_SNAKE_CASE_							(	_snake_case	:int | str				)  ->     bool:
   _A      =       str(_snake_case				)
   return n == n[::-1]

def 	SCREAMING_SNAKE_CASE_							(	_snake_case	:int = 1_000_000				)  ->     Any:
   _A      =       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'''



def        UpperCAmelCase (    A	:					int					):
							if not isinstance(A       ,		A					):
														SCREAMING_SNAKE_CASE       :   List[str]         =      F"""Input value of [number={number}] must be an integer"""
														raise TypeError(A					)
							if number < 0:
														return False
							SCREAMING_SNAKE_CASE       :   List[str]         =      number * number
							while number > 0:
														if number % 10 != number_square % 10:
																					return False
														number //= 10
														number_square //= 10
							return True


if __name__ == "__main__":
							import doctest

							doctest.testmod()




