






class  SCREAMING_SNAKE_CASE			:
     '''simple docstring'''


     def __init__(				self       :	Union[str, Any]					, UpperCAmelCase_       :	str					, UpperCAmelCase_       :	Union[str, Any]					, UpperCAmelCase_       :	Any      ):
       SCREAMING_SNAKE_CASE       :      List[Any]							=    name
       SCREAMING_SNAKE_CASE       :      Optional[Any]							=    value
       SCREAMING_SNAKE_CASE       :      List[Any]							=    weight


     def __repr__(				self       :	int      ):
       return f'''{self.__class__.__name__}({self.name}, {self.value}, {self.weight})'''


     def 				_A       (				self       :	Any      ):
       return self.value


     def 				_A       (				self       :	int      ):
       return self.name


     def 				_A       (				self       :	Any      ):
       return self.weight






     def 				_A       (				self       :	List[str]      ):
       return self.value / self.weight





def   lowerCamelCase__			(     lowercase						,     lowercase						,     lowercase				):

  """simple docstring"""






  SCREAMING_SNAKE_CASE       :      str							=    []
  for i in range(len(lowercase				)				):
    menu.append(Things(name[i]						,     value[i]						,     weight[i]				)				)
  return menu


def   lowerCamelCase__			(     lowercase						,     lowercase						,     lowercase				):

  """simple docstring"""






  SCREAMING_SNAKE_CASE       :      List[Any]							=    sorted(lowercase						,     key=lowercase						,     reverse=lowercase				)
  SCREAMING_SNAKE_CASE       :      int							=    []
  SCREAMING_SNAKE_CASE       :      Optional[int]							=    0.0, 0.0
  for i in range(len(lowercase				)				):
    if (total_cost + items_copy[i].get_weight()) <= max_cost:
      result.append(items_copy[i]				)
      total_cost += items_copy[i].get_weight()
      total_value += items_copy[i].get_value()
  return (result, total_value)


def   lowerCamelCase__			(     ):

  """simple docstring"""














if __name__ == "__main__":
   import doctest

   doctest.testmod()









from __future__ import annotations


def   lowerCamelCase__			(     lowercase				):

  """simple docstring"""






  SCREAMING_SNAKE_CASE       :      Optional[Any]							=    str(lowercase				)
  return n == n[::-1]


def   lowerCamelCase__			(     lowercase = 1000000				):

  """simple docstring"""






  SCREAMING_SNAKE_CASE       :      int							=    0

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


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






