



'''simple docstring'''

def       __lowercase  (_SCREAMING_SNAKE_CASE      :list       ):

				def merge(_SCREAMING_SNAKE_CASE      :list    ,	_SCREAMING_SNAKE_CASE      :list       ) -> list:

								def _merge():
												while left and right:
																yield (left if left[0] <= right[0] else right).pop(0       )
												yield from left
												yield from right

								return list(_merge()       )

				if len(_SCREAMING_SNAKE_CASE       ) <= 1:
								return collection
				SCREAMING_SNAKE_CASE  :						Optional[Any]      					= len(_SCREAMING_SNAKE_CASE       ) // 2
				return merge(merge_sort(collection[:mid]       )    ,	merge_sort(collection[mid:]       )       )


if __name__ == "__main__":
	import doctest

	doctest.testmod()
	snake_case_			=     input("""Enter numbers separated by a comma:\n""").strip()
	snake_case_			=     [int(item) for item in user_input.split(""",""")]
	print(*merge_sort(unsorted), sep=""",""")






'''simple docstring'''

from __future__ import annotations






def       __lowercase  (_SCREAMING_SNAKE_CASE      :int | str       ):
				SCREAMING_SNAKE_CASE  :						int      					= str(_SCREAMING_SNAKE_CASE       )
				return n == n[::-1]






def       __lowercase  (_SCREAMING_SNAKE_CASE      :int = 1_00_00_00       ):
				SCREAMING_SNAKE_CASE  :						int      					= 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()))))




