


from pathlib import Path

import numpy as np
from PIL import Image
def 				__lowerCamelCase						( UpperCAmelCase_						:		np.ndarray						):




      """simple docstring"""





      a							,				a							,				a						:List[Any] 							=       rgb[:, :, 0], rgb[:, :, 1], rgb[:, :, 2]
      return 0.2989 * r + 0.5870 * g + 0.1140 * b
def 				__lowerCamelCase						( UpperCAmelCase_						:		np.ndarray						):




      """simple docstring"""





      return (gray > 127) & (gray <= 255)
def 				__lowerCamelCase						( UpperCAmelCase_						:		np.ndarray ,  UpperCAmelCase_						:		np.ndarray						):




      """simple docstring"""





      a						:str 							=       np.zeros_like(UpperCAmelCase_						)
      a						:List[str] 							=       np.zeros(
          (image.shape[0] + kernel.shape[0] - 1, image.shape[1] + kernel.shape[1] - 1)						)

      # Copy image to padded image
      a						:Dict 							=       image

      # Iterate over image & apply kernel
      for x in range(image.shape[1]						):
            for y in range(image.shape[0]						):
                  a						:Union[str, Any] 							=       (
                      kernel * image_padded[y : y + kernel.shape[0], x : x + kernel.shape[1]]
                  ).sum()
                  a						:Any 							=       int(summation > 0						)
      return output


if __name__ == "__main__":
     # read original image
     snake_case				:    Dict       				=     Path(__file__).resolve().parent / '''image_data''' / '''lena.jpg'''
     snake_case				:    Dict       				=     np.array(Image.open(lena_path))
     # kernel to be applied
     snake_case				:    Optional[int]       				=     np.array([[0, 1, 0], [1, 1, 1], [0, 1, 0]])
     snake_case				:    Dict       				=     dilation(gray_to_binary(rgb_to_gray(lena)), structuring_element)
     # Save the output image
     snake_case				:    Dict       				=     Image.fromarray(output).convert('''RGB''')
     pil_img.save('''result_dilation.png''')









def 				__lowerCamelCase						( UpperCAmelCase_						:		int = 1000						):




      """simple docstring"""





      a							,				a						:int 							=       1, 1
      a						:Any 							=       2
      while True:
            a						:Optional[int] 							=       0
            a						:str 							=       fa + fa
            a							,				a						:List[Any] 							=       fa, f
            index += 1
            for _ in str(UpperCAmelCase_						):
                  i += 1
            if i == n:
                  break
      return index


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





