"""simple docstring"""






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

from ...tokenization_utils import PreTrainedTokenizer
from ...utils import logging


__A			   = logging.get_logger(__name__)

__A			   = {
    "vocab_file": "vocab.txt",
    "merges_file": "bpe.codes",
}

__A			   = {
    "vocab_file": {
        "vinai/phobert-base": "https://huggingface.co/vinai/phobert-base/resolve/main/vocab.txt",
        "vinai/phobert-large": "https://huggingface.co/vinai/phobert-large/resolve/main/vocab.txt",
    },
    "merges_file": {
        "vinai/phobert-base": "https://huggingface.co/vinai/phobert-base/resolve/main/bpe.codes",
        "vinai/phobert-large": "https://huggingface.co/vinai/phobert-large/resolve/main/bpe.codes",
    },
}

__A			   = {
    "vinai/phobert-base": 2_5_6,
    "vinai/phobert-large": 2_5_6,
}



def SCREAMING_SNAKE_CASE__			(   __UpperCAmelCase )  ->  int:
   lowercase__:   List[str]					=      set()
   lowercase__:   int					=      word[0]
   for char in word[1:]:
      pairs.add((prev_char, char) )
      lowercase__:   Optional[Any]					=      char

   lowercase__:   int					=      set(__UpperCAmelCase )
   return pairs




class     UpperCAmelCase						(_UpperCAmelCase  ):



    """simple docstring"""

    _UpperCAmelCase	:Any						    = VOCAB_FILES_NAMES
    _UpperCAmelCase	:Optional[int]						    = PRETRAINED_VOCAB_FILES_MAP
    _UpperCAmelCase	:str						    = PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES






    def __init__(   self    ,			_UpperCAmelCase    ,			_UpperCAmelCase    ,			_UpperCAmelCase="<s>"    ,			_UpperCAmelCase="</s>"    ,			_UpperCAmelCase="</s>"    ,			_UpperCAmelCase="<s>"    ,			_UpperCAmelCase="<unk>"    ,			_UpperCAmelCase="<pad>"    ,			_UpperCAmelCase="<mask>"    ,			**_UpperCAmelCase    ,			):
       super().__init__(
           bos_token=_UpperCAmelCase    ,			eos_token=_UpperCAmelCase    ,			unk_token=_UpperCAmelCase    ,			sep_token=_UpperCAmelCase    ,			cls_token=_UpperCAmelCase    ,			pad_token=_UpperCAmelCase    ,			mask_token=_UpperCAmelCase    ,			**_UpperCAmelCase    ,			)

       lowercase__:   Any					=      vocab_file
       lowercase__:   str					=      merges_file

       lowercase__:   str					=      {}
       lowercase__:   int					=      0
       lowercase__:   Any					=      1
       lowercase__:   Optional[int]					=      2
       lowercase__:   Optional[int]					=      3

       self.add_from_file(_UpperCAmelCase							)

       lowercase__:   Optional[int]					=      {v: k for k, v in self.encoder.items()}

       with open(_UpperCAmelCase    ,			encoding='''utf-8'''							) as merges_handle:
          lowercase__:   Any					=      merges_handle.read().split('''\n'''							)[:-1]
       lowercase__:   List[str]					=      [tuple(merge.split()[:-1]							) for merge in merges]
       lowercase__:   Optional[int]					=      dict(zip(_UpperCAmelCase    ,			range(len(_UpperCAmelCase							)							)							)							)
       lowercase__:   Tuple					=      {}






    def _snake_case			(   self    ,			_UpperCAmelCase    ,			_UpperCAmelCase = None							):

       if token_ids_a is None:
          return [self.cls_token_id] + token_ids_a + [self.sep_token_id]
       lowercase__:   Dict					=      [self.cls_token_id]
       lowercase__:   Optional[Any]					=      [self.sep_token_id]
       return cls + token_ids_a + sep + sep + token_ids_a + sep






    def _snake_case			(   self    ,			_UpperCAmelCase    ,			_UpperCAmelCase = None    ,			_UpperCAmelCase = False							):

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

       if token_ids_a is None:
          return [1] + ([0] * len(_UpperCAmelCase							)) + [1]
       return [1] + ([0] * len(_UpperCAmelCase							)) + [1, 1] + ([0] * len(_UpperCAmelCase							)) + [1]






    def _snake_case			(   self    ,			_UpperCAmelCase    ,			_UpperCAmelCase = None							):
       lowercase__:   Any					=      [self.sep_token_id]
       lowercase__:   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]






    @property
    def _snake_case			(   self							):
       return len(self.encoder							)






    def _snake_case			(   self							):
       return dict(self.encoder    ,			**self.added_tokens_encoder							)






    def _snake_case			(   self    ,			_UpperCAmelCase							):
       if token in self.cache:
          return self.cache[token]
       lowercase__:   Any					=      tuple(_UpperCAmelCase							)
       lowercase__:   Union[str, Any]					=      tuple(list(word[:-1]							) + [word[-1] + '''</w>''']							)
       lowercase__:   int					=      get_pairs(_UpperCAmelCase							)

       if not pairs:
          return token

       while True:
          lowercase__:   List[Any]					=      min(_UpperCAmelCase    ,			key=lambda _UpperCAmelCase							: self.bpe_ranks.get(_UpperCAmelCase    ,			float('''inf'''							)							)							)
          if bigram not in self.bpe_ranks:
             break
          lowercase__, lowercase__:   Optional[int]					=      bigram
          lowercase__:   str					=      []
          lowercase__:   Optional[Any]					=      0
          while i < len(_UpperCAmelCase							):
             try:
                lowercase__:   List[str]					=      word.index(_UpperCAmelCase    ,			_UpperCAmelCase							)
             except ValueError:
                new_word.extend(word[i:]							)
                break
             else:
                new_word.extend(word[i:j]							)
                lowercase__:   Any					=      j

             if word[i] == first and i < len(_UpperCAmelCase							) - 1 and word[i + 1] == second:
                new_word.append(first + second							)
                i += 2
             else:
                new_word.append(word[i]							)
                i += 1
          lowercase__:   Union[str, Any]					=      tuple(_UpperCAmelCase							)
          lowercase__:   str					=      new_word
          if len(_UpperCAmelCase							) == 1:
             break
          else:
             lowercase__:   List[Any]					=      get_pairs(_UpperCAmelCase							)
       lowercase__:   str					=      '''@@ '''.join(_UpperCAmelCase							)
       lowercase__:   Union[str, Any]					=      word[:-4]
       lowercase__:   Union[str, Any]					=      word
       return word






    def _snake_case			(   self    ,			_UpperCAmelCase							):
       lowercase__:   Union[str, Any]					=      []

       lowercase__:   Any					=      re.findall(r'''\S+\n?'''    ,			_UpperCAmelCase							)

       for token in words:
          split_tokens.extend(list(self.bpe(_UpperCAmelCase							).split(''' '''							)							)							)
       return split_tokens






    def _snake_case			(   self    ,			_UpperCAmelCase							):
       return self.encoder.get(_UpperCAmelCase    ,			self.encoder.get(self.unk_token							)							)






    def _snake_case			(   self    ,			_UpperCAmelCase							):
       return self.decoder.get(_UpperCAmelCase    ,			self.unk_token							)






    def _snake_case			(   self    ,			_UpperCAmelCase							):
       lowercase__:   Optional[int]					=      ''' '''.join(_UpperCAmelCase							).replace('''@@ '''    ,			''''''							).strip()
       return out_string






    def _snake_case			(   self    ,			_UpperCAmelCase    ,			_UpperCAmelCase = None							):
       if not os.path.isdir(_UpperCAmelCase							):
          logger.error(F"""Vocabulary path ({save_directory}) should be a directory"""							)
          return
       lowercase__:   List[Any]					=      os.path.join(
           _UpperCAmelCase    ,			(filename_prefix + '''-''' if filename_prefix else '''''') + VOCAB_FILES_NAMES['''vocab_file''']							)
       lowercase__:   Tuple					=      os.path.join(
           _UpperCAmelCase    ,			(filename_prefix + '''-''' if filename_prefix else '''''') + VOCAB_FILES_NAMES['''merges_file''']							)

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

       if os.path.abspath(self.merges_file							) != os.path.abspath(_UpperCAmelCase							):
          copyfile(self.merges_file    ,			_UpperCAmelCase							)

       return out_vocab_file, out_merge_file






    def _snake_case			(   self    ,			_UpperCAmelCase							):
       if isinstance(_UpperCAmelCase    ,			_UpperCAmelCase							):
          try:
             with open(_UpperCAmelCase    ,			'''r'''    ,			encoding='''utf-8'''							) as fd:
                self.add_from_file(_UpperCAmelCase							)
          except FileNotFoundError as fnfe:
             raise fnfe
          except UnicodeError:
             raise Exception(F"""Incorrect encoding detected in {f}, please rebuild the dataset"""							)
          return

       lowercase__:   Optional[int]					=      f.readlines()
       for lineTmp in lines:
          lowercase__:   int					=      lineTmp.strip()
          lowercase__:   Any					=      line.rfind(''' '''							)
          if idx == -1:
             raise ValueError('''Incorrect dictionary format, expected \'<token> <cnt>\''''							)
          lowercase__:   Tuple					=      line[:idx]
          lowercase__:   int					=      len(self.encoder							)

"""simple docstring"""






def SCREAMING_SNAKE_CASE__			(   __UpperCAmelCase )  ->  int:
   if n == 1 or not isinstance(__UpperCAmelCase       ,    __UpperCAmelCase ):
      return 0
   elif n == 2:
      return 1
   else:
      lowercase__:   List[Any]					=      [0, 1]
      for i in range(2       ,    n + 1 ):
         sequence.append(sequence[i - 1] + sequence[i - 2] )

      return sequence[n]



def SCREAMING_SNAKE_CASE__			(   __UpperCAmelCase )  ->  int:
   lowercase__:   Union[str, Any]					=      0
   lowercase__:   List[Any]					=      2

   while digits < n:
      index += 1
      lowercase__:   Dict					=      len(str(fibonacci(__UpperCAmelCase ) ) )

   return index



def SCREAMING_SNAKE_CASE__			(   __UpperCAmelCase = 1_0_0_0 )  ->  int:
   return fibonacci_digits_index(__UpperCAmelCase )


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