


from __future__ import annotations

from collections.abc import Callable
from typing import Generic, TypeVar

SCREAMING_SNAKE_CASE			: Tuple				   =					TypeVar("T")
SCREAMING_SNAKE_CASE			: List[Any]				   =					TypeVar("U")






class _lowerCamelCase(		Generic[T, U]  ):
       def __init__(   self, lowerCamelCase, lowerCamelCase)			->  Dict:




           """simple docstring"""

           _lowercase			:				Optional[int] 						=						key
           _lowercase			:				Union[str, Any] 						=						val
           _lowercase			:				DoubleLinkedListNode[T, U] | None 						=						None
           _lowercase			:				DoubleLinkedListNode[T, U] | None 						=						None




       def __repr__(   self)			->  str:




           """simple docstring"""

           return (
               F'''Node: key: {self.key}, val: {self.val}, '''
               F'''has next: {bool(self.next)}, has prev: {bool(self.prev)}'''
           )






class _lowerCamelCase(		Generic[T, U]  ):
       def __init__(   self)			->  None:




           """simple docstring"""

           _lowercase			:				DoubleLinkedListNode[T, U] 						=						DoubleLinkedListNode(lowerCamelCase, lowerCamelCase)
           _lowercase			:				DoubleLinkedListNode[T, U] 						=						DoubleLinkedListNode(lowerCamelCase, lowerCamelCase)
           _lowercase						,							_lowercase			:				Tuple 						=						self.rear, self.head
       def __repr__(   self)			->  str:




           """simple docstring"""

           _lowercase			:				int 						=						['DoubleLinkedList']
           _lowercase			:				Optional[int] 						=						self.head
           while node.next is not None:
               rep.append(str(lowerCamelCase))
               _lowercase			:				int 						=						node.next
           rep.append(str(self.rear))
           return ",\n    ".join(lowerCamelCase)
       def      UpperCamelCase	(   self, lowerCamelCase)			->  None:




           """simple docstring"""

           _lowercase			:				List[Any] 						=						self.rear.prev

           # All nodes other than self.head are guaranteed to have non-None previous
           assert previous is not None

           _lowercase			:				Union[str, Any] 						=						node
           _lowercase			:				Dict 						=						previous
           _lowercase			:				Union[str, Any] 						=						node
           _lowercase			:				Union[str, Any] 						=						self.rear




       def      UpperCamelCase	(   self, lowerCamelCase)			->  DoubleLinkedListNode[T, U] | None:




           """simple docstring"""

           if node.prev is None or node.next is None:
               return None

           _lowercase			:				Union[str, Any] 						=						node.next
           _lowercase			:				Union[str, Any] 						=						node.prev
           _lowercase			:				Tuple 						=						None
           _lowercase			:				int 						=						None
           return node






class _lowerCamelCase(		Generic[T, U]  ):
       lowercase_					:      dict[Callable[[T], U], LRUCache[T, U]]       					=     {}
       def __init__(   self, lowerCamelCase)			->  Optional[Any]:




           """simple docstring"""

           _lowercase			:				DoubleLinkedList[T, U] 						=						DoubleLinkedList()
           _lowercase			:				Optional[Any] 						=						capacity
           _lowercase			:				Optional[Any] 						=						0
           _lowercase			:				str 						=						0
           _lowercase			:				Optional[Any] 						=						0
           _lowercase			:				dict[T, DoubleLinkedListNode[T, U]] 						=						{}
       def __repr__(   self)			->  str:




           """simple docstring"""

           return (
               F'''CacheInfo(hits={self.hits}, misses={self.miss}, '''
               F'''capacity={self.capacity}, current size={self.num_keys})'''
           )
       def __contains__(   self, lowerCamelCase)			->  bool:




           """simple docstring"""

           return key in self.cache
       def      UpperCamelCase	(   self, lowerCamelCase)			->  U | None:




           """simple docstring"""

           if key in self.cache:
               self.hits += 1
               _lowercase			:				DoubleLinkedListNode[T, U] 						=						self.cache[key]
               _lowercase			:				List[Any] 						=						self.list.remove(self.cache[key])
               assert node == value_node

               # node is guaranteed not None because it is in self.cache
               assert node is not None
               self.list.add(lowerCamelCase)
               return node.val
           self.miss += 1
           return None
       def      UpperCamelCase	(   self, lowerCamelCase, lowerCamelCase)			->  None:




           """simple docstring"""

           if key not in self.cache:
               if self.num_keys >= self.capacity:
                   # delete first node (oldest) when over capacity
                   _lowercase			:				List[str] 						=						self.list.head.next

                   # guaranteed to have a non-None first node when num_keys > 0
                   # explain to type checker via assertions
                   assert first_node is not None
                   assert first_node.key is not None
                   assert (
                       self.list.remove(lowerCamelCase) is not None
                   )  # node guaranteed to be in list assert node.key is not None

                   del self.cache[first_node.key]
                   self.num_keys -= 1
               _lowercase			:				Union[str, Any] 						=						DoubleLinkedListNode(lowerCamelCase, lowerCamelCase)
               self.list.add(self.cache[key])
               self.num_keys += 1

           else:
               # bump node to the end of the list, update value
               _lowercase			:				int 						=						self.list.remove(self.cache[key])
               assert node is not None  # node guaranteed to be in list
               _lowercase			:				str 						=						value
               self.list.add(lowerCamelCase)




       @classmethod
       def      UpperCamelCase	(   cls, lowerCamelCase = 1_28)			->  Callable[[Callable[[T], U]], Callable[..., U]]:




           """simple docstring"""

           def cache_decorator_inner(lowerCamelCase) -> Callable[..., U]:
               def cache_decorator_wrapper(*lowerCamelCase) -> U:
                   if func not in cls.decorator_function_to_instance_map:
                       _lowercase			:				int 						=						LRUCache(lowerCamelCase)

                   _lowercase			:				Optional[int] 						=						cls.decorator_function_to_instance_map[func].get(args[0])
                   if result is None:
                       _lowercase			:				List[Any] 						=						func(*lowerCamelCase)
                       cls.decorator_function_to_instance_map[func].put(args[0], lowerCamelCase)
                   return result

               def cache_info() -> LRUCache[T, U]:
                   return cls.decorator_function_to_instance_map[func]

               setattr(lowerCamelCase, 'cache_info', lowerCamelCase)  # noqa: B010

               return cache_decorator_wrapper

           return cache_decorator_inner


if __name__ == "__main__":
 import doctest

 doctest.testmod()






def 							UpperCamelCase_( lowerCamelCase_					)       ->		int:
    if n == 1 or not isinstance(lowerCamelCase_				,					lowerCamelCase_					):
        return 0
    elif n == 2:
        return 1
    else:
        _lowercase			:				List[str] 						=						[0, 1]
        for i in range(2				,					n + 1					):
            sequence.append(sequence[i - 1] + sequence[i - 2]					)

        return sequence[n]



def 							UpperCamelCase_( lowerCamelCase_					)       ->		int:
    _lowercase			:				Tuple 						=						0
    _lowercase			:				List[str] 						=						2

    while digits < n:
        index += 1
        _lowercase			:				Optional[int] 						=						len(str(fibonacci(lowerCamelCase_					)					)					)

    return index



def 							UpperCamelCase_( lowerCamelCase_ = 1000					)       ->		int:
    return fibonacci_digits_index(lowerCamelCase_					)


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


