




"""simple docstring"""





import warnings
from typing import Dict, List, Optional, Tuple

from ...tokenization_utils import AddedToken, PreTrainedTokenizer
from ...utils import logging


A				=							logging.get_logger(__name__)



class   a__					(						__magic_name__ ):
			lowercase_		=						["input_ids", "attention_mask"]


			def __init__(   self   :     Optional[Any]   ,	UpperCamelCase_   :     List[Any]="</s>"   ,	UpperCamelCase_   :     Tuple="<unk>"   ,	UpperCamelCase_   :     List[str]="<pad>"   ,	UpperCamelCase_   :     Union[str, Any]=125   ,	UpperCamelCase_   :     Dict=None   ,	**UpperCamelCase_   :     Optional[Any]   ,	):


						"""simple docstring"""




						if extra_ids > 0 and additional_special_tokens is None:
									__UpperCAmelCase						:			int												=       [F"<extra_id_{i}>" for i in range(UpperCamelCase_)]
						elif extra_ids > 0 and additional_special_tokens is not None:
									# Check that we have the right number of extra_id special tokens
									__UpperCAmelCase						:			Dict												=       len(set(filter(lambda UpperCamelCase_: bool("extra_id" in str(UpperCamelCase_))   ,	UpperCamelCase_)))
									if extra_tokens != extra_ids:
												raise ValueError(
												    F"Both extra_ids ({extra_ids}) and additional_special_tokens ({additional_special_tokens}) are"
												    " provided to ByT5Tokenizer. In this case the additional_special_tokens must include the"
												    " extra_ids tokens")

						__UpperCAmelCase						:			List[str]												=       AddedToken(UpperCamelCase_   ,	lstrip=UpperCamelCase_   ,	rstrip=UpperCamelCase_) if isinstance(UpperCamelCase_   ,	UpperCamelCase_) else pad_token
						__UpperCAmelCase						:			List[str]												=       AddedToken(UpperCamelCase_   ,	lstrip=UpperCamelCase_   ,	rstrip=UpperCamelCase_) if isinstance(UpperCamelCase_   ,	UpperCamelCase_) else eos_token
						__UpperCAmelCase						:			Optional[int]												=       AddedToken(UpperCamelCase_   ,	lstrip=UpperCamelCase_   ,	rstrip=UpperCamelCase_) if isinstance(UpperCamelCase_   ,	UpperCamelCase_) else unk_token

						super().__init__(
						    eos_token=UpperCamelCase_   ,	unk_token=UpperCamelCase_   ,	pad_token=UpperCamelCase_   ,	extra_ids=UpperCamelCase_   ,	additional_special_tokens=UpperCamelCase_   ,	**UpperCamelCase_   ,	)

						__UpperCAmelCase						:			List[str]												=       extra_ids

						__UpperCAmelCase						:			int												=       2**8  # utf is 8 bits

						# define special tokens dict
						__UpperCAmelCase						:			Dict[int, str]												=       {
						    self.pad_token: 0,
						    self.eos_token: 1,
						    self.unk_token: 2,
						}
						__UpperCAmelCase						:			Any												=       len(self.special_tokens_encoder)
						__UpperCAmelCase						:			List[Any]												=       len(UpperCamelCase_)
						for i, token in enumerate(UpperCamelCase_):
									__UpperCAmelCase						:			Union[str, Any]												=       self.vocab_size + i - n
						__UpperCAmelCase						:			Dict[str, int]												=       {v: k for k, v in self.special_tokens_encoder.items()}


			@property
			def    a_  (   self   :     List[Any]):


						"""simple docstring"""




						return self._utf_vocab_size + self._num_special_tokens + self._extra_ids


			def    a_  (   self   :     List[str]   ,	UpperCamelCase_   :     List[int]   ,	UpperCamelCase_   :     Optional[List[int]] = None   ,	UpperCamelCase_   :     bool = False):


						"""simple docstring"""




						if already_has_special_tokens:
									return super().get_special_tokens_mask(
									    token_ids_a=UpperCamelCase_   ,	token_ids_a=UpperCamelCase_   ,	already_has_special_tokens=UpperCamelCase_)

						# normal case: some special tokens
						if token_ids_a is None:
									return ([0] * len(UpperCamelCase_)) + [1]
						return ([0] * len(UpperCamelCase_)) + [1] + ([0] * len(UpperCamelCase_)) + [1]


			def    a_  (   self   :     Optional[Any]   ,	UpperCamelCase_   :     List[int]):


						"""simple docstring"""




						if len(UpperCamelCase_) > 0 and token_ids[-1] == self.eos_token_id:
									warnings.warn(
									    F"This sequence already has {self.eos_token}. In future versions this behavior may lead to duplicated"
									    " eos tokens being added.")
									return token_ids
						else:
									return token_ids + [self.eos_token_id]


			def    a_  (   self   :     Dict   ,	UpperCamelCase_   :     List[int]   ,	UpperCamelCase_   :     Optional[List[int]] = None):


						"""simple docstring"""




						__UpperCAmelCase						:			Dict												=       [self.eos_token_id]

						if token_ids_a is None:
									return len(token_ids_a + eos) * [0]
						return len(token_ids_a + eos + token_ids_a + eos) * [0]


			def    a_  (   self   :     Optional[int]   ,	UpperCamelCase_   :     List[int]   ,	UpperCamelCase_   :     Optional[List[int]] = None):


						"""simple docstring"""




						__UpperCAmelCase						:			Optional[Any]												=       self._add_eos_if_not_present(UpperCamelCase_)
						if token_ids_a is None:
									return token_ids_a
						else:
									__UpperCAmelCase						:			List[Any]												=       self._add_eos_if_not_present(UpperCamelCase_)
									return token_ids_a + token_ids_a


			def    a_  (   self   :     List[str]   ,	UpperCamelCase_   :     str):


						"""simple docstring"""




						__UpperCAmelCase						:			Any												=       [chr(UpperCamelCase_) for i in text.encode("utf-8")]
						return tokens


			def    a_  (   self   :     Tuple   ,	UpperCamelCase_   :     List[Any]):


						"""simple docstring"""




						if token in self.special_tokens_encoder:
									__UpperCAmelCase						:			Any												=       self.special_tokens_encoder[token]
						elif token in self.added_tokens_encoder:
									__UpperCAmelCase						:			int												=       self.added_tokens_encoder[token]
						elif len(UpperCamelCase_) != 1:
									__UpperCAmelCase						:			Optional[Any]												=       self.unk_token_id
						else:
									__UpperCAmelCase						:			Any												=       ord(UpperCamelCase_) + self._num_special_tokens
						return token_id


			def    a_  (   self   :     Any   ,	UpperCamelCase_   :     List[str]):


						"""simple docstring"""




						if index in self.special_tokens_decoder:
									__UpperCAmelCase						:			Any												=       self.special_tokens_decoder[index]
						else:
									__UpperCAmelCase						:			List[str]												=       chr(index - self._num_special_tokens)
						return token


			def    a_  (   self   :     Dict   ,	UpperCamelCase_   :     int):


						"""simple docstring"""




						__UpperCAmelCase						:			str												=       b""
						for token in tokens:
									if token in self.special_tokens_decoder:
												__UpperCAmelCase						:			Tuple												=       self.special_tokens_decoder[token].encode("utf-8")
									elif token in self.added_tokens_decoder:
												__UpperCAmelCase						:			Any												=       self.special_tokens_decoder[token].encode("utf-8")
									elif token in self.special_tokens_encoder:
												__UpperCAmelCase						:			Optional[int]												=       token.encode("utf-8")
									elif token in self.added_tokens_encoder:
												__UpperCAmelCase						:			Optional[Any]												=       token.encode("utf-8")
									else:
												__UpperCAmelCase						:			Any												=       bytes([ord(UpperCamelCase_)])
									bstring += tok_string
						__UpperCAmelCase						:			List[Any]												=       bstring.decode("utf-8"   ,	errors="ignore")
						return string


			def    a_  (   self   :     Optional[int]   ,	UpperCamelCase_   :     str   ,	UpperCamelCase_   :     Optional[str] = None):


						"""simple docstring"""




						return ()



'''simple docstring'''






from __future__ import annotations





def  _SCREAMING_SNAKE_CASE		(      __snake_case							:			int | str				):
     _A    		=  str(__snake_case				)
     return n == n[::-1]





def  _SCREAMING_SNAKE_CASE		(      __snake_case							:			int = 1_0_0_0_0_0_0				):
     _A    		=  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()))))



