


from typing import Dict, List, Optional, Union

import numpy as np

from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict
from ...image_transforms import rescale, resize, to_channel_dimension_format
from ...image_utils import (
    ChannelDimension,
    ImageInput,
    PILImageResampling,
    make_list_of_images,
    to_numpy_array,
    valid_images,
)
from ...utils import TensorType, is_vision_available, logging


if is_vision_available():
     import PIL


snake_case				:    Any       				=     logging.get_logger(__name__)
def 				__lowerCamelCase						( UpperCAmelCase_						:		Union[str, Any] ,  UpperCAmelCase_						:		Tuple						):




      """simple docstring"""





      a						:Any 							=       b.T
      a						:Tuple 							=       np.sum(np.square(UpperCAmelCase_						) ,  axis=1						)
      a						:Union[str, Any] 							=       np.sum(np.square(UpperCAmelCase_						) ,  axis=0						)
      a						:Tuple 							=       np.matmul(UpperCAmelCase_ ,  UpperCAmelCase_						)
      a						:List[str] 							=       aa[:, None] - 2 * ab + ba[None, :]
      return d
def 				__lowerCamelCase						( UpperCAmelCase_						:		List[str] ,  UpperCAmelCase_						:		int						):




      """simple docstring"""





      a						:Union[str, Any] 							=       x.reshape(-1 ,  3						)
      a						:List[Any] 							=       squared_euclidean_distance(UpperCAmelCase_ ,  UpperCAmelCase_						)
      return np.argmin(UpperCAmelCase_ ,  axis=1						)







class 		_snake_case  (      _snake_case							):
 SCREAMING_SNAKE_CASE__      =       ['pixel_values']




 def __init__(		self					,  _lowerCamelCase = None					,  _lowerCamelCase = True					,  _lowerCamelCase = None					,  _lowerCamelCase = PILImageResampling.BILINEAR					,  _lowerCamelCase = True					,  _lowerCamelCase = True					,  **_lowerCamelCase					,  ):
       super().__init__(**_lowerCamelCase    )
       a						:int 							=       size if size is not None else {'''height''': 256, '''width''': 256}
       a						:Any 							=       get_size_dict(_lowerCamelCase    )
       a						:List[Any] 							=       np.array(_lowerCamelCase    ) if clusters is not None else None
       a						:Optional[Any] 							=       do_resize
       a						:Any 							=       size
       a						:Dict 							=       resample
       a						:Optional[int] 							=       do_normalize
       a						:Optional[int] 							=       do_color_quantize




 def        SCREAMING_SNAKE_CASE__				(		self					,  _lowerCamelCase					,  _lowerCamelCase					,  _lowerCamelCase = PILImageResampling.BILINEAR					,  _lowerCamelCase = None					,  **_lowerCamelCase					,  ):
       a						:Optional[Any] 							=       get_size_dict(_lowerCamelCase    )
       if "height" not in size or "width" not in size:
             raise ValueError(F'''Size dictionary must contain both height and width keys. Got {size.keys()}'''    )
       return resize(
           _lowerCamelCase					,  size=(size['''height'''], size['''width'''])					,  resample=_lowerCamelCase					,  data_format=_lowerCamelCase					,  **_lowerCamelCase    )




 def        SCREAMING_SNAKE_CASE__				(		self					,  _lowerCamelCase					,  _lowerCamelCase = None					,  ):
       a						:int 							=       rescale(image=_lowerCamelCase					,  scale=1 / 127.5					,  data_format=_lowerCamelCase    )
       a						:List[Any] 							=       image - 1
       return image




 def        SCREAMING_SNAKE_CASE__				(		self					,  _lowerCamelCase					,  _lowerCamelCase = None					,  _lowerCamelCase = None					,  _lowerCamelCase = None					,  _lowerCamelCase = None					,  _lowerCamelCase = None					,  _lowerCamelCase = None					,  _lowerCamelCase = None					,  _lowerCamelCase = ChannelDimension.FIRST					,  **_lowerCamelCase					,  ):
       a						:Optional[int] 							=       do_resize if do_resize is not None else self.do_resize
       a						:Optional[Any] 							=       size if size is not None else self.size
       a						:Optional[int] 							=       get_size_dict(_lowerCamelCase    )
       a						:Union[str, Any] 							=       resample if resample is not None else self.resample
       a						:int 							=       do_normalize if do_normalize is not None else self.do_normalize
       a						:Tuple 							=       do_color_quantize if do_color_quantize is not None else self.do_color_quantize
       a						:List[str] 							=       clusters if clusters is not None else self.clusters
       a						:List[str] 							=       np.array(_lowerCamelCase    )

       a						:List[Any] 							=       make_list_of_images(_lowerCamelCase    )

       if not valid_images(_lowerCamelCase    ):
             raise ValueError(
                 '''Invalid image type. Must be of type PIL.Image.Image, numpy.ndarray, '''
                 '''torch.Tensor, tf.Tensor or jax.ndarray.'''    )

       if do_resize and size is None or resample is None:
             raise ValueError('''Size and resample must be specified if do_resize is True.'''    )

       if do_color_quantize and clusters is None:
             raise ValueError('''Clusters must be specified if do_color_quantize is True.'''    )

       # All transformations expect numpy arrays.
       a						:Tuple 							=       [to_numpy_array(_lowerCamelCase    ) for image in images]

       if do_resize:
             a						:List[str] 							=       [self.resize(image=_lowerCamelCase					,  size=_lowerCamelCase					,  resample=_lowerCamelCase    ) for image in images]

       if do_normalize:
             a						:List[Any] 							=       [self.normalize(image=_lowerCamelCase    ) for image in images]

       if do_color_quantize:
             a						:Union[str, Any] 							=       [to_channel_dimension_format(_lowerCamelCase					,  ChannelDimension.LAST    ) for image in images]
             # color quantize from (batch_size, height, width, 3) to (batch_size, height, width)
             a						:Union[str, Any] 							=       np.array(_lowerCamelCase    )
             a						:List[Any] 							=       color_quantize(_lowerCamelCase					,  _lowerCamelCase    ).reshape(images.shape[:-1]    )

             # flatten to (batch_size, height*width)
             a						:List[str] 							=       images.shape[0]
             a						:Optional[Any] 							=       images.reshape(_lowerCamelCase					,  -1    )

             # We need to convert back to a list of images to keep consistent behaviour across processors.
             a						:Optional[int] 							=       list(_lowerCamelCase    )
       else:
             a						:Tuple 							=       [to_channel_dimension_format(_lowerCamelCase					,  _lowerCamelCase    ) for image in images]

       a						:Any 							=       {'''input_ids''': images}
       return BatchFeature(data=_lowerCamelCase					,  tensor_type=_lowerCamelCase    )









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())))





