






def   lowerCamelCase__			(     lowercase						,     lowercase						,     lowercase				):

  """simple docstring"""






  return not any(
      neighbour == 1 and colored_vertices[i] == color
      for i, neighbour in enumerate(lowercase				)				)


def   lowerCamelCase__			(     lowercase						,     lowercase						,     lowercase						,     lowercase				):

  """simple docstring"""






  if index == len(lowercase				):
    return True

  # Recursive Step
  for i in range(lowercase				):
    if valid_coloring(graph[index]						,     lowercase						,     lowercase				):
      # Color current vertex
      SCREAMING_SNAKE_CASE       :      Tuple							=    i
      # Validate coloring
      if util_color(lowercase						,     lowercase						,     lowercase						,     index + 1				):
        return True
      # Backtrack
      SCREAMING_SNAKE_CASE       :      Any							=    -1
  return False


def   lowerCamelCase__			(     lowercase						,     lowercase				):

  """simple docstring"""






  SCREAMING_SNAKE_CASE       :      Optional[Any]							=    [-1] * len(lowercase				)

  if util_color(lowercase						,     lowercase						,     lowercase						,     0				):
    return colored_vertices

  return []














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()))))






