'''simple docstring'''


from __future__ import annotations

def   A_      (       SCREAMING_SNAKE_CASE_						)			->bool:
  lowercase_     =       str(SCREAMING_SNAKE_CASE_						)
  return n == n[::-1]

def   A_      (       SCREAMING_SNAKE_CASE_ = 1_00_00_00						)			->Union[str, Any]:
  lowercase_     =       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()))))


'''simple docstring'''


def   A_      (       SCREAMING_SNAKE_CASE_						)			->bool:
  if num < 0:
    return False

  lowercase_     =       num
  lowercase_     =       0
  while num > 0:
    lowercase_     =       rev_num * 10 + (num % 10)
    num //= 10

  return num_copy == rev_num


if __name__ == "__main__":
       import doctest

       doctest.testmod()

