

'''simple docstring'''




def    lowerCamelCase__		(    SCREAMING_SNAKE_CASE   : int							, SCREAMING_SNAKE_CASE   : int							, SCREAMING_SNAKE_CASE   : list[list[int]]    ):

  def update_area_of_max_square(SCREAMING_SNAKE_CASE   : int							, SCREAMING_SNAKE_CASE   : int    ) -> int:
    # BASE CASE
    if row >= rows or col >= cols:
      return 0

    UpperCAmelCase    				=						update_area_of_max_square(SCREAMING_SNAKE_CASE							, col + 1    )
    UpperCAmelCase    				=						update_area_of_max_square(row + 1							, col + 1    )
    UpperCAmelCase    				=						update_area_of_max_square(row + 1							, SCREAMING_SNAKE_CASE    )

    if mat[row][col]:
      UpperCAmelCase    				=						1 + min([right, diagonal, down]    )
      UpperCAmelCase    				=						max(largest_square_area[0]							, SCREAMING_SNAKE_CASE    )
      return sub_problem_sol
    else:
      return 0

  UpperCAmelCase    				=						[0]
  update_area_of_max_square(0							, 0    )
  return largest_square_area[0]


def    lowerCamelCase__		(    SCREAMING_SNAKE_CASE   : int							, SCREAMING_SNAKE_CASE   : int							, SCREAMING_SNAKE_CASE   : list[list[int]]    ):

  def update_area_of_max_square_using_dp_array(
      SCREAMING_SNAKE_CASE   : int							, SCREAMING_SNAKE_CASE   : int							, SCREAMING_SNAKE_CASE   : list[list[int]]    ) -> int:
    if row >= rows or col >= cols:
      return 0
    if dp_array[row][col] != -1:
      return dp_array[row][col]

    UpperCAmelCase    				=						update_area_of_max_square_using_dp_array(SCREAMING_SNAKE_CASE							, col + 1							, SCREAMING_SNAKE_CASE    )
    UpperCAmelCase    				=						update_area_of_max_square_using_dp_array(row + 1							, col + 1							, SCREAMING_SNAKE_CASE    )
    UpperCAmelCase    				=						update_area_of_max_square_using_dp_array(row + 1							, SCREAMING_SNAKE_CASE							, SCREAMING_SNAKE_CASE    )

    if mat[row][col]:
      UpperCAmelCase    				=						1 + min([right, diagonal, down]    )
      UpperCAmelCase    				=						max(largest_square_area[0]							, SCREAMING_SNAKE_CASE    )
      UpperCAmelCase    				=						sub_problem_sol
      return sub_problem_sol
    else:
      return 0

  UpperCAmelCase    				=						[0]
  UpperCAmelCase    				=						[[-1] * cols for _ in range(SCREAMING_SNAKE_CASE    )]
  update_area_of_max_square_using_dp_array(0							, 0							, SCREAMING_SNAKE_CASE    )

  return largest_square_area[0]


def    lowerCamelCase__		(    SCREAMING_SNAKE_CASE   : int							, SCREAMING_SNAKE_CASE   : int							, SCREAMING_SNAKE_CASE   : list[list[int]]    ):
  UpperCAmelCase    				=						[[0] * (cols + 1) for _ in range(rows + 1    )]
  UpperCAmelCase    				=						0
  for row in range(rows - 1							, -1							, -1    ):
    for col in range(cols - 1							, -1							, -1    ):
      UpperCAmelCase    				=						dp_array[row][col + 1]
      UpperCAmelCase    				=						dp_array[row + 1][col + 1]
      UpperCAmelCase    				=						dp_array[row + 1][col]

      if mat[row][col] == 1:
        UpperCAmelCase    				=						1 + min(SCREAMING_SNAKE_CASE							, SCREAMING_SNAKE_CASE							, SCREAMING_SNAKE_CASE    )
        UpperCAmelCase    				=						max(dp_array[row][col]							, SCREAMING_SNAKE_CASE    )
      else:
        UpperCAmelCase    				=						0

  return largest_square_area


def    lowerCamelCase__		(    SCREAMING_SNAKE_CASE   : int							, SCREAMING_SNAKE_CASE   : int							, SCREAMING_SNAKE_CASE   : list[list[int]]    ):
  UpperCAmelCase    				=						[0] * (cols + 1)
  UpperCAmelCase    				=						[0] * (cols + 1)
  UpperCAmelCase    				=						0
  for row in range(rows - 1							, -1							, -1    ):
    for col in range(cols - 1							, -1							, -1    ):
      UpperCAmelCase    				=						current_row[col + 1]
      UpperCAmelCase    				=						next_row[col + 1]
      UpperCAmelCase    				=						next_row[col]

      if mat[row][col] == 1:
        UpperCAmelCase    				=						1 + min(SCREAMING_SNAKE_CASE							, SCREAMING_SNAKE_CASE							, SCREAMING_SNAKE_CASE    )
        UpperCAmelCase    				=						max(current_row[col]							, SCREAMING_SNAKE_CASE    )
      else:
        UpperCAmelCase    				=						0
    UpperCAmelCase    				=						current_row

  return largest_square_area


if __name__ == "__main__":
  import doctest

  doctest.testmod()
  print(largest_square_area_in_matrix_bottom_up(2, 2, [[1, 1], [1, 1]]))





'''simple docstring'''




from __future__ import annotations


def    lowerCamelCase__		(    SCREAMING_SNAKE_CASE   : int | str    ):
  UpperCAmelCase    				=						str(SCREAMING_SNAKE_CASE    )
  return n == n[::-1]


def    lowerCamelCase__		(    SCREAMING_SNAKE_CASE   : int = 100_0000    ):
  UpperCAmelCase    				=						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()))))


