






import os
from shutil import copyfile
from typing import List, Optional, Tuple

from tokenizers import processors

from ...tokenization_utils import AddedToken, BatchEncoding
from ...tokenization_utils_fast import PreTrainedTokenizerFast
from ...utils import is_sentencepiece_available, logging


if is_sentencepiece_available():
   from .tokenization_mbart import MBartTokenizer
else:
   snake_case    				=		None


snake_case    				=		logging.get_logger(__name__)


snake_case    				=		{"""vocab_file""": """sentencepiece.bpe.model""", """tokenizer_file""": """tokenizer.json"""}

snake_case    				=		{
    """vocab_file""": {
        """facebook/mbart-large-en-ro""": (
            """https://huggingface.co/facebook/mbart-large-en-ro/resolve/main/sentencepiece.bpe.model"""
        ),
        """facebook/mbart-large-cc25""": (
            """https://huggingface.co/facebook/mbart-large-cc25/resolve/main/sentencepiece.bpe.model"""
        ),
    },
    """tokenizer_file""": {
        """facebook/mbart-large-en-ro""": """https://huggingface.co/facebook/mbart-large-en-ro/resolve/main/tokenizer.json""",
        """facebook/mbart-large-cc25""": """https://huggingface.co/facebook/mbart-large-cc25/resolve/main/tokenizer.json""",
    },
}

snake_case    				=		{
    """facebook/mbart-large-en-ro""": 1_024,
    """facebook/mbart-large-cc25""": 1_024,
}

# fmt: off
snake_case    				=		["""ar_AR""", """cs_CZ""", """de_DE""", """en_XX""", """es_XX""", """et_EE""", """fi_FI""", """fr_XX""", """gu_IN""", """hi_IN""", """it_IT""", """ja_XX""", """kk_KZ""", """ko_KR""", """lt_LT""", """lv_LV""", """my_MM""", """ne_NP""", """nl_XX""", """ro_RO""", """ru_RU""", """si_LK""", """tr_TR""", """vi_VN""", """zh_CN"""]


class  SCREAMING_SNAKE_CASE			(			lowerCAmelCase					):
     '''simple docstring'''


     UpperCamelCase_							:		List[Any]			=	VOCAB_FILES_NAMES
     UpperCamelCase_							:		List[str]			=	PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES
     UpperCamelCase_							:		Any			=	PRETRAINED_VOCAB_FILES_MAP
     UpperCamelCase_							:		Union[str, Any]			=	['''input_ids''', '''attention_mask''']
     UpperCamelCase_							:		Union[str, Any]			=	MBartTokenizer

     UpperCamelCase_							:		List[int]			=	[]
     UpperCamelCase_							:		List[int]			=	[]


     def __init__(				self       :	int					, UpperCAmelCase_       :	Tuple=None					, UpperCAmelCase_       :	Optional[int]=None					, UpperCAmelCase_       :	Any="<s>"					, UpperCAmelCase_       :	Tuple="</s>"					, UpperCAmelCase_       :	List[Any]="</s>"					, UpperCAmelCase_       :	Tuple="<s>"					, UpperCAmelCase_       :	int="<unk>"					, UpperCAmelCase_       :	Dict="<pad>"					, UpperCAmelCase_       :	Union[str, Any]="<mask>"					, UpperCAmelCase_       :	Optional[Any]=None					, UpperCAmelCase_       :	Optional[int]=None					, UpperCAmelCase_       :	Tuple=None					, **UpperCAmelCase_       :	Optional[Any]					, ):
       # Mask token behave like a normal word, i.e. include the space before it
       SCREAMING_SNAKE_CASE       :      int							=    AddedToken(UpperCAmelCase_					, lstrip=UpperCAmelCase_					, rstrip=UpperCAmelCase_      ) if isinstance(UpperCAmelCase_					, UpperCAmelCase_      ) else mask_token

       super().__init__(
           vocab_file=UpperCAmelCase_					, tokenizer_file=UpperCAmelCase_					, bos_token=UpperCAmelCase_					, eos_token=UpperCAmelCase_					, sep_token=UpperCAmelCase_					, cls_token=UpperCAmelCase_					, unk_token=UpperCAmelCase_					, pad_token=UpperCAmelCase_					, mask_token=UpperCAmelCase_					, src_lang=UpperCAmelCase_					, tgt_lang=UpperCAmelCase_					, additional_special_tokens=UpperCAmelCase_					, **UpperCAmelCase_					, )

       SCREAMING_SNAKE_CASE       :      Optional[int]							=    vocab_file
       SCREAMING_SNAKE_CASE       :      int							=    False if not self.vocab_file else True

       SCREAMING_SNAKE_CASE       :      Any							=    FAIRSEQ_LANGUAGE_CODES.copy()

       if additional_special_tokens is not None:
         # Only add those special tokens if they are not already there.
         _additional_special_tokens.extend(
             [t for t in additional_special_tokens if t not in _additional_special_tokens]      )

       self.add_special_tokens({"additional_special_tokens": _additional_special_tokens}      )
       SCREAMING_SNAKE_CASE       :      List[Any]							=    {
           lang_code: self.convert_tokens_to_ids(UpperCAmelCase_      ) for lang_code in FAIRSEQ_LANGUAGE_CODES
       }

       SCREAMING_SNAKE_CASE       :      str							=    src_lang if src_lang is not None else "en_XX"
       SCREAMING_SNAKE_CASE       :      Tuple							=    self.convert_tokens_to_ids(self._src_lang      )
       SCREAMING_SNAKE_CASE       :      List[Any]							=    tgt_lang
       self.set_src_lang_special_tokens(self._src_lang      )


     @property
     def 				_A       (				self       :	Optional[int]      ):
       return self._src_lang


     @src_lang.setter
     def 				_A       (				self       :	Optional[int]					, UpperCAmelCase_       :	str      ):
       SCREAMING_SNAKE_CASE       :      Any							=    new_src_lang
       self.set_src_lang_special_tokens(self._src_lang      )


     def 				_A       (				self       :	Optional[Any]					, UpperCAmelCase_       :	List[int]					, UpperCAmelCase_       :	Optional[List[int]] = None      ):
       if token_ids_a is None:
         return self.prefix_tokens + token_ids_a + self.suffix_tokens
       # We don't expect to process pairs, but leave the pair logic for API consistency
       return self.prefix_tokens + token_ids_a + token_ids_a + self.suffix_tokens


     def 				_A       (				self       :	List[Any]					, UpperCAmelCase_       :	List[int]					, UpperCAmelCase_       :	Optional[List[int]] = None      ):
       SCREAMING_SNAKE_CASE       :      Union[str, Any]							=    [self.sep_token_id]
       SCREAMING_SNAKE_CASE       :      List[str]							=    [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 + sep + token_ids_a + sep      ) * [0]


     def 				_A       (				self       :	List[Any]					, UpperCAmelCase_       :	Dict					, UpperCAmelCase_       :	str					, UpperCAmelCase_       :	Optional[str]					, UpperCAmelCase_       :	Optional[str]					, **UpperCAmelCase_       :	Dict      ):
       if src_lang is None or tgt_lang is None:
         raise ValueError("Translation requires a `src_lang` and a `tgt_lang` for this model"      )
       SCREAMING_SNAKE_CASE       :      Any							=    src_lang
       SCREAMING_SNAKE_CASE       :      List[str]							=    self(UpperCAmelCase_					, add_special_tokens=UpperCAmelCase_					, return_tensors=UpperCAmelCase_					, **UpperCAmelCase_      )
       SCREAMING_SNAKE_CASE       :      List[str]							=    self.convert_tokens_to_ids(UpperCAmelCase_      )
       SCREAMING_SNAKE_CASE       :      Optional[int]							=    tgt_lang_id
       return inputs


     def 				_A       (				self       :	Tuple					, UpperCAmelCase_       :	List[str]					, UpperCAmelCase_       :	str = "en_XX"					, UpperCAmelCase_       :	Optional[List[str]] = None					, UpperCAmelCase_       :	str = "ro_RO"					, **UpperCAmelCase_       :	str					, ):
       SCREAMING_SNAKE_CASE       :      int							=    src_lang
       SCREAMING_SNAKE_CASE       :      str							=    tgt_lang
       return super().prepare_seqaseq_batch(UpperCAmelCase_					, UpperCAmelCase_					, **UpperCAmelCase_      )


     def 				_A       (				self       :	List[Any]      ):
       return self.set_src_lang_special_tokens(self.src_lang      )


     def 				_A       (				self       :	Dict      ):
       return self.set_tgt_lang_special_tokens(self.tgt_lang      )


     def 				_A       (				self       :	Union[str, Any]					, UpperCAmelCase_       :	Optional[Any]      ):
       SCREAMING_SNAKE_CASE       :      Any							=    self.convert_tokens_to_ids(UpperCAmelCase_      )
       SCREAMING_SNAKE_CASE       :      int							=    []
       SCREAMING_SNAKE_CASE       :      Tuple							=    [self.eos_token_id, self.cur_lang_code]

       SCREAMING_SNAKE_CASE       :      List[Any]							=    self.convert_ids_to_tokens(self.prefix_tokens      )
       SCREAMING_SNAKE_CASE       :      List[str]							=    self.convert_ids_to_tokens(self.suffix_tokens      )

       SCREAMING_SNAKE_CASE       :      List[Any]							=    processors.TemplateProcessing(
           single=prefix_tokens_str + ["$A"] + suffix_tokens_str					, pair=prefix_tokens_str + ["$A", "$B"] + suffix_tokens_str					, special_tokens=list(zip(prefix_tokens_str + suffix_tokens_str					, self.prefix_tokens + self.suffix_tokens      )      )					, )


     def 				_A       (				self       :	str					, UpperCAmelCase_       :	str      ):
       SCREAMING_SNAKE_CASE       :      List[Any]							=    self.convert_tokens_to_ids(UpperCAmelCase_      )
       SCREAMING_SNAKE_CASE       :      List[str]							=    []
       SCREAMING_SNAKE_CASE       :      Tuple							=    [self.eos_token_id, self.cur_lang_code]

       SCREAMING_SNAKE_CASE       :      int							=    self.convert_ids_to_tokens(self.prefix_tokens      )
       SCREAMING_SNAKE_CASE       :      List[Any]							=    self.convert_ids_to_tokens(self.suffix_tokens      )

       SCREAMING_SNAKE_CASE       :      Any							=    processors.TemplateProcessing(
           single=prefix_tokens_str + ["$A"] + suffix_tokens_str					, pair=prefix_tokens_str + ["$A", "$B"] + suffix_tokens_str					, special_tokens=list(zip(prefix_tokens_str + suffix_tokens_str					, self.prefix_tokens + self.suffix_tokens      )      )					, )






     def 				_A       (				self       :	str					, UpperCAmelCase_       :	str					, UpperCAmelCase_       :	Optional[str] = None      ):
       if not self.can_save_slow_tokenizer:
         raise ValueError(
             "Your fast tokenizer does not have the necessary information to save the vocabulary for a slow "
             "tokenizer."      )

       if not os.path.isdir(UpperCAmelCase_      ):
         logger.error(f'''Vocabulary path ({save_directory}) should be a directory.'''      )
         return
       SCREAMING_SNAKE_CASE       :      List[Any]							=    os.path.join(
           UpperCAmelCase_					, (filename_prefix + "-" if filename_prefix else "") + VOCAB_FILES_NAMES["vocab_file"]      )

       if os.path.abspath(self.vocab_file      ) != os.path.abspath(UpperCAmelCase_      ):
         copyfile(self.vocab_file					, UpperCAmelCase_      )

       return (out_vocab_file,)









from __future__ import annotations


def   lowerCamelCase__			(     lowercase				):

  """simple docstring"""






  SCREAMING_SNAKE_CASE       :      Optional[Any]							=    str(lowercase				)
  return n == n[::-1]


def   lowerCamelCase__			(     lowercase = 1000000				):

  """simple docstring"""






  SCREAMING_SNAKE_CASE       :      int							=    0

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


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






