


"""simple docstring"""
import json
from typing import List, Optional, Tuple

from tokenizers import normalizers

from ...tokenization_utils_fast import PreTrainedTokenizerFast
from .tokenization_lxmert import LxmertTokenizer


SCREAMING_SNAKE_CASE :    str									=				{"""vocab_file""": """vocab.txt""", """tokenizer_file""": """tokenizer.json"""}

SCREAMING_SNAKE_CASE :    Union[str, Any]									=				{
    """vocab_file""": {
        """unc-nlp/lxmert-base-uncased""": """https://huggingface.co/unc-nlp/lxmert-base-uncased/resolve/main/vocab.txt""",
    },
    """tokenizer_file""": {
        """unc-nlp/lxmert-base-uncased""": (
            """https://huggingface.co/unc-nlp/lxmert-base-uncased/resolve/main/tokenizer.json"""
        ),
    },
}

SCREAMING_SNAKE_CASE :    Optional[Any]									=				{
    """unc-nlp/lxmert-base-uncased""": 512,
}

SCREAMING_SNAKE_CASE :    List[Any]									=				{
    """unc-nlp/lxmert-base-uncased""": {"""do_lower_case""": True},
}



class 			_UpperCAmelCase (							__snake_case				):






		'''simple docstring'''

		lowerCamelCase__				=VOCAB_FILES_NAMES
		lowerCamelCase__				=PRETRAINED_VOCAB_FILES_MAP
		lowerCamelCase__				=PRETRAINED_INIT_CONFIGURATION
		lowerCamelCase__				=PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES
		lowerCamelCase__				=LxmertTokenizer



		def __init__(self				,       a_=None				,       a_=None				,       a_=True				,       a_="[UNK]"				,       a_="[SEP]"				,       a_="[PAD]"				,       a_="[CLS]"				,       a_="[MASK]"				,       a_=True				,       a_=None				,       **a_				,       ):





			'''simple docstring'''

			super().__init__(
			    a_				,       tokenizer_file=a_				,       do_lower_case=a_				,       unk_token=a_				,       sep_token=a_				,       pad_token=a_				,       cls_token=a_				,       mask_token=a_				,       tokenize_chinese_chars=a_				,       strip_accents=a_				,       **a_				,       )

			__snake_case	:						Optional[Any]						=				json.loads(self.backend_tokenizer.normalizer.__getstate__()					)
			if (
			    normalizer_state.get('''lowercase'''				,       a_					) != do_lower_case
			    or normalizer_state.get('''strip_accents'''				,       a_					) != strip_accents
			    or normalizer_state.get('''handle_chinese_chars'''				,       a_					) != tokenize_chinese_chars
			):
				__snake_case	:						Optional[Any]						=				getattr(a_				,       normalizer_state.pop('''type'''					)					)
				__snake_case	:						Optional[Any]						=				do_lower_case
				__snake_case	:						Optional[int]						=				strip_accents
				__snake_case	:						Union[str, Any]						=				tokenize_chinese_chars
				__snake_case	:						List[str]						=				normalizer_class(**a_					)

			__snake_case	:						List[str]						=				do_lower_case



		def 				SCREAMING_SNAKE_CASE  (self				,       a_				,       a_=None					):





			'''simple docstring'''

			__snake_case	:						Dict						=				[self.cls_token_id] + token_ids_a + [self.sep_token_id]

			if token_ids_a:
				output += token_ids_a + [self.sep_token_id]

			return output



		def 				SCREAMING_SNAKE_CASE  (self				,       a_				,       a_ = None					):





			'''simple docstring'''

			__snake_case	:						Optional[int]						=				[self.sep_token_id]
			__snake_case	:						Any						=				[self.cls_token_id]
			if token_ids_a is None:
				return len(cls + token_ids_a + sep					) * [0]
			return len(cls + token_ids_a + sep					) * [0] + len(token_ids_a + sep					) * [1]



		def 				SCREAMING_SNAKE_CASE  (self				,       a_				,       a_ = None					):





			'''simple docstring'''

			__snake_case	:						Optional[Any]						=				self._tokenizer.model.save(a_				,       name=a_					)
			return tuple(a_					)









"""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()))))





