



'''simple docstring'''

import inspect
import unittest

class __snake_case(				unittest.TestCase ):


	'''simple docstring'''



	def     __snake_case   ( self				)     ->     Tuple:
		try:
			import diffusers  # noqa: F401
		except ImportError:
			assert False




	def     __snake_case   ( self				)     ->     Optional[Any]:
		import diffusers
		from diffusers.dependency_versions_table import deps

		lowerCAmelCase   =     inspect.getmembers(A_     ,	inspect.isclass				)

		for cls_name, cls_module in all_classes:
			if "dummy_" in cls_module.__module__:
				for backend in cls_module._backends:
					if backend == "k_diffusion":
						lowerCAmelCase   =     """k-diffusion"""
					elif backend == "invisible_watermark":
						lowerCAmelCase   =     """invisible-watermark"""
					assert backend in deps, f'{backend} is not in the deps table!'




'''simple docstring'''

from __future__ import annotations






def 		_snake_case		( _SCREAMING_SNAKE_CASE					:						int | str							)      ->						bool:







	"""simple docstring"""
	lowerCAmelCase   =     str(_SCREAMING_SNAKE_CASE							)
	return n == n[::-1]






def 		_snake_case		( _SCREAMING_SNAKE_CASE					:						int = 1_000_000							)      ->						Dict:







	"""simple docstring"""
	lowerCAmelCase   =     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()))))