
import argparse

import intel_extension_for_pytorch as ipex
import torch

from diffusers import DPMSolverMultistepScheduler, StableDiffusionPipeline


_SCREAMING_SNAKE_CASE    :      str          =			argparse.ArgumentParser('Stable Diffusion script with intel optimization', add_help=False)
parser.add_argument('--dpm', action='store_true', help='Enable DPMSolver or not')
parser.add_argument('--steps', default=None, type=int, help='Num inference steps')
_SCREAMING_SNAKE_CASE    :      List[str]          =			parser.parse_args()


_SCREAMING_SNAKE_CASE    :      Optional[Any]          =			'cpu'
_SCREAMING_SNAKE_CASE    :      Any          =			'a lovely <dicoo> in red dress and hat, in the snowly and brightly night, with many brighly buildings'

_SCREAMING_SNAKE_CASE    :      Any          =			'path-to-your-trained-model'
_SCREAMING_SNAKE_CASE    :      int          =			StableDiffusionPipeline.from_pretrained(model_id)
if args.dpm:
	_SCREAMING_SNAKE_CASE    :      Dict          =			DPMSolverMultistepScheduler.from_config(pipe.scheduler.config)
_SCREAMING_SNAKE_CASE    :      Optional[int]          =			pipe.to(device)

# to channels last
_SCREAMING_SNAKE_CASE    :      Tuple          =			pipe.unet.to(memory_format=torch.channels_last)
_SCREAMING_SNAKE_CASE    :      List[Any]          =			pipe.vae.to(memory_format=torch.channels_last)
_SCREAMING_SNAKE_CASE    :      List[str]          =			pipe.text_encoder.to(memory_format=torch.channels_last)
if pipe.requires_safety_checker:
	_SCREAMING_SNAKE_CASE    :      Tuple          =			pipe.safety_checker.to(memory_format=torch.channels_last)

# optimize with ipex
_SCREAMING_SNAKE_CASE    :      Any          =			torch.randn(2, 4, 6_4, 6_4)
_SCREAMING_SNAKE_CASE    :      List[str]          =			torch.rand(1) * 9_9_9
_SCREAMING_SNAKE_CASE    :      int          =			torch.randn(2, 7_7, 7_6_8)
_SCREAMING_SNAKE_CASE    :      Union[str, Any]          =			(sample, timestep, encoder_hidden_status)
try:
	_SCREAMING_SNAKE_CASE    :      int          =			ipex.optimize(pipe.unet.eval(), dtype=torch.bfloataa, inplace=True, sample_input=input_example)
except Exception:
	_SCREAMING_SNAKE_CASE    :      List[str]          =			ipex.optimize(pipe.unet.eval(), dtype=torch.bfloataa, inplace=True)
_SCREAMING_SNAKE_CASE    :      Optional[int]          =			ipex.optimize(pipe.vae.eval(), dtype=torch.bfloataa, inplace=True)
_SCREAMING_SNAKE_CASE    :      Any          =			ipex.optimize(pipe.text_encoder.eval(), dtype=torch.bfloataa, inplace=True)
if pipe.requires_safety_checker:
	_SCREAMING_SNAKE_CASE    :      Union[str, Any]          =			ipex.optimize(pipe.safety_checker.eval(), dtype=torch.bfloataa, inplace=True)

# compute
_SCREAMING_SNAKE_CASE    :      Union[str, Any]          =			6_6_6
_SCREAMING_SNAKE_CASE    :      Any          =			torch.Generator(device).manual_seed(seed)
_SCREAMING_SNAKE_CASE    :      List[str]          =			{'generator': generator}
if args.steps is not None:
	_SCREAMING_SNAKE_CASE    :      List[str]          =			args.steps

with torch.cpu.amp.autocast(enabled=True, dtype=torch.bfloataa):
	_SCREAMING_SNAKE_CASE    :      Optional[Any]          =			pipe(prompt, **generate_kwargs).images[0]

# save image
image.save('generated.png')

def 				SCREAMING_SNAKE_CASE     (      __UpperCamelCase :						int       ) ->       int:

				"""simple docstring"""







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

								return sequence[n]

def 				SCREAMING_SNAKE_CASE     (      __UpperCamelCase :						int       ) ->       int:

				"""simple docstring"""







				A__  :	Dict         =							0
				A__  :	Optional[int]         =							2

				while digits < n:
								index += 1
								A__  :	Dict         =							len(str(fibonacci(__UpperCamelCase       )       )       )

				return index

def 				SCREAMING_SNAKE_CASE     (      __UpperCamelCase :						int = 10_00       ) ->       int:

				"""simple docstring"""







				return fibonacci_digits_index(__UpperCamelCase       )


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