'''simple docstring'''

import gc
import unittest

from diffusers import FlaxStableDiffusionInpaintPipeline
from diffusers.utils import is_flax_available, load_image, slow
from diffusers.utils.testing_utils import require_flax


if is_flax_available():
       import jax
       import jax.numpy as jnp
       from flax.jax_utils import replicate
       from flax.training.common_utils import shard





@slow
@require_flax
class 							lowercase						(						unittest.TestCase ):


   def __UpperCAmelCase       (   self				:	List[str])      ->					List[Any]:
         # clean up the VRAM after each test
         super().tearDown()
         gc.collect()


   def __UpperCAmelCase       (   self				:	List[Any])      ->					Optional[Any]:
         lowercase_     =      load_image(
             "https://huggingface.co/datasets/hf-internal-testing/diffusers-images/resolve/main"
             "/sd2-inpaint/init_image.png")
         lowercase_     =      load_image(
             "https://huggingface.co/datasets/hf-internal-testing/diffusers-images/resolve/main/sd2-inpaint/mask.png")

         lowercase_     =      "xvjiarui/stable-diffusion-2-inpainting"
         lowercase_ ,							lowercase_     =      FlaxStableDiffusionInpaintPipeline.from_pretrained(__lowerCAmelCase   ,		safety_checker=__lowerCAmelCase)

         lowercase_     =      "Face of a yellow cat, high resolution, sitting on a park bench"

         lowercase_     =      jax.random.PRNGKey(0)
         lowercase_     =      50

         lowercase_     =      jax.device_count()
         lowercase_     =      num_samples * [prompt]
         lowercase_     =      num_samples * [init_image]
         lowercase_     =      num_samples * [mask_image]
         lowercase_ ,							lowercase_ ,							lowercase_     =      pipeline.prepare_inputs(__lowerCAmelCase   ,		__lowerCAmelCase   ,		__lowerCAmelCase)

         # shard inputs and rng
         lowercase_     =      replicate(__lowerCAmelCase)
         lowercase_     =      jax.random.split(__lowerCAmelCase   ,		jax.device_count())
         lowercase_     =      shard(__lowerCAmelCase)
         lowercase_     =      shard(__lowerCAmelCase)
         lowercase_     =      shard(__lowerCAmelCase)

         lowercase_     =      pipeline(
             __lowerCAmelCase   ,		__lowerCAmelCase   ,		__lowerCAmelCase   ,		__lowerCAmelCase   ,		__lowerCAmelCase   ,		__lowerCAmelCase   ,		jit=__lowerCAmelCase)

         lowercase_     =      output.images.reshape(__lowerCAmelCase   ,		512   ,		512   ,		3)

         lowercase_     =      images[0, 253:256, 253:256, -1]

         lowercase_     =      jnp.asarray(jax.device_get(image_slice.flatten()))
         lowercase_     =      jnp.array(
             [0.361_1307, 0.3764_9736, 0.375_7408, 0.3821_3953, 0.3929_5167, 0.384_1631, 0.4155_4978, 0.413_7475, 0.421_7084])
         print(F'output_slice: {output_slice}')
         assert jnp.abs(output_slice - expected_slice).max() < 1e-2







'''simple docstring'''

from __future__ import annotations


def __a (	__lowerCamelCase			:						int | str				)	->							bool:
      '''simple docstring'''


      lowercase_     =      str(__lowerCamelCase				)
      return n == n[::-1]


def __a (	__lowerCamelCase			:						int = 1_000_000				)	->							Optional[int]:
      '''simple docstring'''


      lowercase_     =      0

      for i in range(1 ,		__lowerCamelCase				):
            if is_palindrome(__lowerCamelCase				) and is_palindrome(bin(__lowerCamelCase				).split("b"				)[1]				):
                  total += i
      return total


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






