




import unittest

import numpy as np
import requests

from transformers.testing_utils import require_torch, require_vision
from transformers.utils import is_torch_available, is_vision_available

from ...test_image_processing_common import ImageProcessingSavingTestMixin, prepare_image_inputs


if is_torch_available():
		import torch

		from transformers.pytorch_utils import is_torch_greater_or_equal_than_1_11
else:
		lowercase__							:	Tuple											=		False

if is_vision_available():
		from PIL import Image

		from transformers import PixaStructImageProcessor
class 						UpperCAmelCase  (							unittest.TestCase     ):







						'''simple docstring'''





						def __init__(		self				:	List[Any]			,      __lowercase				:	Union[str, Any]			,      __lowercase				:	Optional[Any]=7			,      __lowercase				:	str=3			,      __lowercase				:	int=18			,      __lowercase				:	List[str]=30			,      __lowercase				:	int=4_00			,      __lowercase				:	Optional[Any]=None			,      __lowercase				:	Optional[int]=True			,      __lowercase				:	Union[str, Any]=True			,      __lowercase				:	Dict=None			,      ):






							"""simple docstring"""






							snake_case_						       =	size if size is not None else {"height": 20, "width": 20}
							snake_case_						       =	parent
							snake_case_						       =	batch_size
							snake_case_						       =	num_channels
							snake_case_						       =	image_size
							snake_case_						       =	min_resolution
							snake_case_						       =	max_resolution
							snake_case_						       =	size
							snake_case_						       =	do_normalize
							snake_case_						       =	do_convert_rgb
							snake_case_						       =	[5_12, 10_24, 20_48, 40_96]
							snake_case_						       =	patch_size if patch_size is not None else {"height": 16, "width": 16}






						def 			snake_case__		(		self				:	str		):






							"""simple docstring"""






							return {"do_normalize": self.do_normalize, "do_convert_rgb": self.do_convert_rgb}






						def 			snake_case__		(		self				:	List[str]		):






							"""simple docstring"""






							snake_case_						       =	"https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/transformers/tasks/australia.jpg"
							snake_case_						       =	Image.open(requests.get(__lowerCAmelCase			,      stream=__lowerCAmelCase		).raw		).convert("RGB"		)
							return raw_image







@unittest.skipIf(
    not is_torch_greater_or_equal_than_1_11			,  reason='''`Pix2StructImageProcessor` requires `torch>=1.11.0`.'''			,  )
@require_torch
@require_vision
class 						UpperCAmelCase  (							lowerCAmelCase_			,  unittest.TestCase     ):







						'''simple docstring'''





						lowerCAmelCase_							=  PixaStructImageProcessor if is_vision_available() else None






						def 			snake_case__		(		self				:	Optional[int]		):






							"""simple docstring"""






							snake_case_						       =	PixaStructImageProcessingTester(self		)






						@property
						def 			snake_case__		(		self				:	Any		):






							"""simple docstring"""






							return self.image_processor_tester.prepare_image_processor_dict()






						def 			snake_case__		(		self				:	str		):






							"""simple docstring"""






							snake_case_						       =	self.image_processing_class(**self.image_processor_dict		)
							self.assertTrue(hasattr(__lowerCAmelCase			,      "do_normalize"		)		)
							self.assertTrue(hasattr(__lowerCAmelCase			,      "do_convert_rgb"		)		)






						def 			snake_case__		(		self				:	List[Any]		):






							"""simple docstring"""






							snake_case_						       =	self.image_processor_tester.prepare_dummy_image()

							snake_case_						       =	self.image_processing_class(**self.image_processor_dict		)
							snake_case_						       =	20_48

							snake_case_						       =	image_processor(__lowerCAmelCase			,      return_tensors="pt"			,      max_patches=__lowerCAmelCase		)
							self.assertTrue(torch.allclose(inputs.flattened_patches.mean()			,      torch.tensor(0.0606		)			,      atol=1E-3			,      rtol=1E-3		)		)






						def 			snake_case__		(		self				:	Optional[int]		):






							"""simple docstring"""






							snake_case_						       =	self.image_processing_class(**self.image_processor_dict		)
							# create random PIL images
							snake_case_						       =	prepare_image_inputs(self.image_processor_tester			,      equal_resolution=__lowerCAmelCase		)
							for image in image_inputs:
								self.assertIsInstance(__lowerCAmelCase			,      Image.Image		)

							# Test not batched input
							snake_case_						       =	(
							    (self.image_processor_tester.patch_size["height"] * self.image_processor_tester.patch_size["width"])
							    * self.image_processor_tester.num_channels
							) + 2

							for max_patch in self.image_processor_tester.max_patches:
								# Test not batched input
								snake_case_						       =	image_processor(
								    image_inputs[0]			,      return_tensors="pt"			,      max_patches=__lowerCAmelCase		).flattened_patches
								self.assertEqual(
								    encoded_images.shape			,      (1, max_patch, expected_hidden_dim)			,      )

								# Test batched
								snake_case_						       =	image_processor(
								    __lowerCAmelCase			,      return_tensors="pt"			,      max_patches=__lowerCAmelCase		).flattened_patches
								self.assertEqual(
								    encoded_images.shape			,      (self.image_processor_tester.batch_size, max_patch, expected_hidden_dim)			,      )






						def 			snake_case__		(		self				:	List[str]		):






							"""simple docstring"""






							snake_case_						       =	self.image_processing_class(**self.image_processor_dict		)
							# create random PIL images
							snake_case_						       =	prepare_image_inputs(self.image_processor_tester			,      equal_resolution=__lowerCAmelCase		)
							for image in image_inputs:
								self.assertIsInstance(__lowerCAmelCase			,      Image.Image		)

							# Test not batched input
							snake_case_						       =	(
							    (self.image_processor_tester.patch_size["height"] * self.image_processor_tester.patch_size["width"])
							    * self.image_processor_tester.num_channels
							) + 2

							snake_case_						       =	True

							for max_patch in self.image_processor_tester.max_patches:
								# Test not batched input
								with self.assertRaises(__lowerCAmelCase		):
									snake_case_						       =	image_processor(
									    image_inputs[0]			,      return_tensors="pt"			,      max_patches=__lowerCAmelCase		).flattened_patches

								snake_case_						       =	"Hello"

								snake_case_						       =	image_processor(
								    image_inputs[0]			,      return_tensors="pt"			,      max_patches=__lowerCAmelCase			,      header_text=__lowerCAmelCase		).flattened_patches
								self.assertEqual(
								    encoded_images.shape			,      (1, max_patch, expected_hidden_dim)			,      )

								# Test batched
								snake_case_						       =	image_processor(
								    __lowerCAmelCase			,      return_tensors="pt"			,      max_patches=__lowerCAmelCase			,      header_text=__lowerCAmelCase		).flattened_patches
								self.assertEqual(
								    encoded_images.shape			,      (self.image_processor_tester.batch_size, max_patch, expected_hidden_dim)			,      )






						def 			snake_case__		(		self				:	List[Any]		):






							"""simple docstring"""






							snake_case_						       =	self.image_processing_class(**self.image_processor_dict		)
							# create random numpy tensors
							snake_case_						       =	prepare_image_inputs(self.image_processor_tester			,      equal_resolution=__lowerCAmelCase			,      numpify=__lowerCAmelCase		)
							for image in image_inputs:
								self.assertIsInstance(__lowerCAmelCase			,      np.ndarray		)

							snake_case_						       =	(
							    (self.image_processor_tester.patch_size["height"] * self.image_processor_tester.patch_size["width"])
							    * self.image_processor_tester.num_channels
							) + 2

							for max_patch in self.image_processor_tester.max_patches:
								# Test not batched input
								snake_case_						       =	image_processor(
								    image_inputs[0]			,      return_tensors="pt"			,      max_patches=__lowerCAmelCase		).flattened_patches
								self.assertEqual(
								    encoded_images.shape			,      (1, max_patch, expected_hidden_dim)			,      )

								# Test batched
								snake_case_						       =	image_processor(
								    __lowerCAmelCase			,      return_tensors="pt"			,      max_patches=__lowerCAmelCase		).flattened_patches
								self.assertEqual(
								    encoded_images.shape			,      (self.image_processor_tester.batch_size, max_patch, expected_hidden_dim)			,      )






						def 			snake_case__		(		self				:	Union[str, Any]		):






							"""simple docstring"""






							snake_case_						       =	self.image_processing_class(**self.image_processor_dict		)
							# create random PyTorch tensors
							snake_case_						       =	prepare_image_inputs(self.image_processor_tester			,      equal_resolution=__lowerCAmelCase			,      torchify=__lowerCAmelCase		)
							for image in image_inputs:
								self.assertIsInstance(__lowerCAmelCase			,      torch.Tensor		)

							# Test not batched input
							snake_case_						       =	(
							    (self.image_processor_tester.patch_size["height"] * self.image_processor_tester.patch_size["width"])
							    * self.image_processor_tester.num_channels
							) + 2

							for max_patch in self.image_processor_tester.max_patches:
								# Test not batched input
								snake_case_						       =	image_processor(
								    image_inputs[0]			,      return_tensors="pt"			,      max_patches=__lowerCAmelCase		).flattened_patches
								self.assertEqual(
								    encoded_images.shape			,      (1, max_patch, expected_hidden_dim)			,      )

								# Test batched
								snake_case_						       =	image_processor(
								    __lowerCAmelCase			,      return_tensors="pt"			,      max_patches=__lowerCAmelCase		).flattened_patches
								self.assertEqual(
								    encoded_images.shape			,      (self.image_processor_tester.batch_size, max_patch, expected_hidden_dim)			,      )







@unittest.skipIf(
    not is_torch_greater_or_equal_than_1_11			,  reason='''`Pix2StructImageProcessor` requires `torch>=1.11.0`.'''			,  )
@require_torch
@require_vision
class 						UpperCAmelCase  (							lowerCAmelCase_			,  unittest.TestCase     ):







						'''simple docstring'''





						lowerCAmelCase_							=  PixaStructImageProcessor if is_vision_available() else None






						def 			snake_case__		(		self				:	Any		):






							"""simple docstring"""






							snake_case_						       =	PixaStructImageProcessingTester(self			,      num_channels=4		)
							snake_case_						       =	3






						@property
						def 			snake_case__		(		self				:	str		):






							"""simple docstring"""






							return self.image_processor_tester.prepare_image_processor_dict()






						def 			snake_case__		(		self				:	Dict		):






							"""simple docstring"""






							snake_case_						       =	self.image_processing_class(**self.image_processor_dict		)
							self.assertTrue(hasattr(__lowerCAmelCase			,      "do_normalize"		)		)
							self.assertTrue(hasattr(__lowerCAmelCase			,      "do_convert_rgb"		)		)






						def 			snake_case__		(		self				:	Any		):






							"""simple docstring"""






							snake_case_						       =	self.image_processing_class(**self.image_processor_dict		)
							# create random PIL images
							snake_case_						       =	prepare_image_inputs(self.image_processor_tester			,      equal_resolution=__lowerCAmelCase		)
							for image in image_inputs:
								self.assertIsInstance(__lowerCAmelCase			,      Image.Image		)

							# Test not batched input
							snake_case_						       =	(
							    (self.image_processor_tester.patch_size["height"] * self.image_processor_tester.patch_size["width"])
							    * (self.image_processor_tester.num_channels - 1)
							) + 2

							for max_patch in self.image_processor_tester.max_patches:
								# Test not batched input
								snake_case_						       =	image_processor(
								    image_inputs[0]			,      return_tensors="pt"			,      max_patches=__lowerCAmelCase		).flattened_patches
								self.assertEqual(
								    encoded_images.shape			,      (1, max_patch, expected_hidden_dim)			,      )

								# Test batched
								snake_case_						       =	image_processor(
								    __lowerCAmelCase			,      return_tensors="pt"			,      max_patches=__lowerCAmelCase		).flattened_patches
								self.assertEqual(
								    encoded_images.shape			,      (self.image_processor_tester.batch_size, max_patch, expected_hidden_dim)			,      )

"""simple docstring"""


from collections.abc import Generator






def      __UpperCAmelCase       (      ):







  """simple docstring"""
  _UpperCAmelCase			,					_UpperCAmelCase    			=   0, 1
  while True:
    _UpperCAmelCase			,					_UpperCAmelCase    			=   b, a + b
    yield b






def      __UpperCAmelCase       (      lowercase = 10_00		):







  """simple docstring"""
  _UpperCAmelCase    			=   1
  _UpperCAmelCase    			=   fibonacci_generator()
  while len(str(next(lowercase		)		)		) < n:
    answer += 1
  return answer + 1


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