


"""simple docstring"""
from typing import TYPE_CHECKING

from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available


SCREAMING_SNAKE_CASE :    Dict									=				{
    """configuration_rag""": ["""RagConfig"""],
    """retrieval_rag""": ["""RagRetriever"""],
    """tokenization_rag""": ["""RagTokenizer"""],
}

try:
			if not is_torch_available():
						raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
			pass
else:
			SCREAMING_SNAKE_CASE :    Any									=				[
			    """RagModel""",
			    """RagPreTrainedModel""",
			    """RagSequenceForGeneration""",
			    """RagTokenForGeneration""",
			]

try:
			if not is_tf_available():
						raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
			pass
else:
			SCREAMING_SNAKE_CASE :    List[str]									=				[
			    """TFRagModel""",
			    """TFRagPreTrainedModel""",
			    """TFRagSequenceForGeneration""",
			    """TFRagTokenForGeneration""",
			]


if TYPE_CHECKING:
			from .configuration_rag import RagConfig
			from .retrieval_rag import RagRetriever
			from .tokenization_rag import RagTokenizer

			try:
						if not is_torch_available():
									raise OptionalDependencyNotAvailable()
			except OptionalDependencyNotAvailable:
						pass
			else:
						from .modeling_rag import RagModel, RagPreTrainedModel, RagSequenceForGeneration, RagTokenForGeneration

			try:
						if not is_tf_available():
									raise OptionalDependencyNotAvailable()
			except OptionalDependencyNotAvailable:
						pass
			else:
						from .modeling_tf_rag import (
						    TFRagModel,
						    TFRagPreTrainedModel,
						    TFRagSequenceForGeneration,
						    TFRagTokenForGeneration,
						)

else:
			import sys

			SCREAMING_SNAKE_CASE :    Any									=				_LazyModule(__name__, globals()["""__file__"""], _import_structure, module_spec=__spec__)









"""simple docstring"""
from __future__ import annotations






def 		lowercase							(     _snake_case						:      int | str     )     ->bool:
	"""simple docstring"""





	__snake_case	:						List[str]						=				str(_snake_case     )
	return n == n[::-1]






def 		lowercase							(     _snake_case						:      int = 1_000_000     )     ->str:
	"""simple docstring"""





	__snake_case	:						Union[str, Any]						=				0

	for i in range(1     ,   _snake_case     ):
		if is_palindrome(_snake_case     ) and is_palindrome(bin(_snake_case     ).split('''b'''     )[1]     ):
			total += i
	return total


if __name__ == "__main__":
			print(solution(int(str(input().strip()))))





