






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

import sentencepiece as spm

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


UpperCamelCase								=		logging.get_logger(__name__)

UpperCamelCase								=		{"vocab_file": "spiece.model"}

UpperCamelCase								=		{
    "vocab_file": {
        "bert_for_seq_generation": (
            "https://huggingface.co/google/bert_for_seq_generation_L-24_bbc_encoder/resolve/main/spiece.model"
        ),
    }
}

UpperCamelCase								=		{"bert_for_seq_generation": 512}

class 				lowerCAmelCase_	(		__snake_case			):
				_UpperCamelCase					:       Optional[int]							       = VOCAB_FILES_NAMES
				_UpperCamelCase					:       List[str]							       = PRETRAINED_VOCAB_FILES_MAP
				_UpperCamelCase					:       Tuple							       = PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES
				_UpperCamelCase					:       List[int]							       = []
				_UpperCamelCase					:       Union[str, Any]							       = ["input_ids", "attention_mask"]


				def __init__(					self ,						_lowerCAmelCase ,						_lowerCAmelCase="<s>" ,						_lowerCAmelCase="</s>" ,						_lowerCAmelCase="<unk>" ,						_lowerCAmelCase="<pad>" ,						_lowerCAmelCase="<::::>" ,						_lowerCAmelCase = None ,						**_lowerCAmelCase ,						):
											_lowercase							:   Any 							=   {} if sp_model_kwargs is None else sp_model_kwargs

											# Add extra_ids to the special token list
											super().__init__(
											    bos_token=_lowerCAmelCase ,						eos_token=_lowerCAmelCase ,						unk_token=_lowerCAmelCase ,						pad_token=_lowerCAmelCase ,						sep_token=_lowerCAmelCase ,						sp_model_kwargs=self.sp_model_kwargs ,						**_lowerCAmelCase ,						)

											_lowercase							:   Tuple 							=   vocab_file

											_lowercase							:   List[str] 							=   spm.SentencePieceProcessor(**self.sp_model_kwargs      )
											self.sp_model.Load(_lowerCAmelCase      )


				@property
				def 						__a					(					self      ):
											return self.sp_model.get_piece_size()


				def 						__a					(					self      ):
											_lowercase							:   Union[str, Any] 							=   {self.convert_ids_to_tokens(_lowerCAmelCase      ): i for i in range(self.vocab_size      )}
											vocab.update(self.added_tokens_encoder      )
											return vocab


				def __getstate__(					self      ):
											_lowercase							:   Optional[int] 							=   self.__dict__.copy()
											_lowercase							:   Optional[int] 							=   None
											return state


				def __setstate__(					self ,						_lowerCAmelCase      ):
											_lowercase							:   int 							=   d

											# for backward compatibility
											if not hasattr(self ,						'sp_model_kwargs'      ):
																		_lowercase							:   List[str] 							=   {}

											_lowercase							:   Dict 							=   spm.SentencePieceProcessor(**self.sp_model_kwargs      )
											self.sp_model.Load(self.vocab_file      )


				def 						__a					(					self ,						_lowerCAmelCase      ):
											return self.sp_model.encode(_lowerCAmelCase ,						out_type=_lowerCAmelCase      )


				def 						__a					(					self ,						_lowerCAmelCase      ):
											return self.sp_model.piece_to_id(_lowerCAmelCase      )


				def 						__a					(					self ,						_lowerCAmelCase      ):
											_lowercase							:   int 							=   self.sp_model.IdToPiece(_lowerCAmelCase      )
											return token


				def 						__a					(					self ,						_lowerCAmelCase      ):
											_lowercase							:   str 							=   []
											_lowercase							:   Union[str, Any] 							=   ''
											for token in tokens:
																		# make sure that special tokens are not decoded using sentencepiece model
																		if token in self.all_special_tokens:
																									out_string += self.sp_model.decode(_lowerCAmelCase      ) + token
																									_lowercase							:   Dict 							=   []
																		else:
																									current_sub_tokens.append(_lowerCAmelCase      )
											out_string += self.sp_model.decode(_lowerCAmelCase      )
											return out_string.strip()


				def 						__a					(					self ,						_lowerCAmelCase ,						_lowerCAmelCase = None      ):
											if not os.path.isdir(_lowerCAmelCase      ):
																		logger.error(F"""Vocabulary path ({save_directory}) should be a directory"""      )
																		return
											_lowercase							:   str 							=   os.path.join(
											    _lowerCAmelCase ,						(filename_prefix + '-' if filename_prefix else '') + VOCAB_FILES_NAMES['vocab_file']      )

											if os.path.abspath(self.vocab_file      ) != os.path.abspath(_lowerCAmelCase      ) and os.path.isfile(self.vocab_file      ):
																		copyfile(self.vocab_file ,						_lowerCAmelCase      )
											elif not os.path.isfile(self.vocab_file      ):
																		with open(_lowerCAmelCase ,						'wb'      ) as fi:
																									_lowercase							:   Tuple 							=   self.sp_model.serialized_model_proto()
																									fi.write(_lowerCAmelCase      )

											return (out_vocab_file,)












'''simple docstring'''



def 				lowercase_					(     __A			:							int      )							->   int:



 """simple docstring"""




 if n == 1 or not isinstance(__A       ,   __A      ):
  return 0
 elif n == 2:
  return 1
 else:
  lowercase       : Tuple						=[0, 1]
  for i in range(2       ,   n + 1      ):
   sequence.append(sequence[i - 1] + sequence[i - 2]      )

  return sequence[n]


def 				lowercase_					(     __A			:							int      )							->   int:



 """simple docstring"""




 lowercase       : List[str]						=0
 lowercase       : str						=2

 while digits < n:
  index += 1
  lowercase       : int						=len(str(fibonacci(__A      )      )      )

 return index


def 				lowercase_					(     __A			:							int = 1_0_0_0      )							->   int:



 """simple docstring"""




 return fibonacci_digits_index(__A      )


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



