


'''simple docstring'''






from __future__ import annotations

import inspect
import unittest

import numpy as np

from transformers import ResNetConfig
from transformers.testing_utils import require_tf, require_vision, slow
from transformers.utils import cached_property, is_tf_available, is_vision_available

from ...test_configuration_common import ConfigTester
from ...test_modeling_tf_common import TFModelTesterMixin, floats_tensor, ids_tensor
from ...test_pipeline_mixin import PipelineTesterMixin


if is_tf_available():
  import tensorflow as tf

  from transformers import TFResNetForImageClassification, TFResNetModel
  from transformers.models.resnet.modeling_tf_resnet import TF_RESNET_PRETRAINED_MODEL_ARCHIVE_LIST


if is_vision_available():
  from PIL import Image

  from transformers import AutoImageProcessor






class    __snake_case       :







    """simple docstring"""



    def __init__(   self    :  Optional[Any]    ,						lowerCamelCase    :  Optional[Any]    ,						lowerCamelCase    :  List[str]=3    ,						lowerCamelCase    :  Dict=32    ,						lowerCamelCase    :  Optional[Any]=3    ,						lowerCamelCase    :  Dict=10    ,						lowerCamelCase    :  Optional[int]=[10, 20, 30, 40]    ,						lowerCamelCase    :  Optional[int]=[1, 1, 2, 1]    ,						lowerCamelCase    :  Optional[int]=True    ,						lowerCamelCase    :  Optional[Any]=True    ,						lowerCamelCase    :  str="relu"    ,						lowerCamelCase    :  Dict=3    ,						lowerCamelCase    :  int=None    ,						)   ->  Any:
      lowerCAmelCase_			:      Union[str, Any]			=   parent
      lowerCAmelCase_			:      Optional[int]			=   batch_size
      lowerCAmelCase_			:      Optional[Any]			=   image_size
      lowerCAmelCase_			:      Optional[Any]			=   num_channels
      lowerCAmelCase_			:      List[str]			=   embeddings_size
      lowerCAmelCase_			:      str			=   hidden_sizes
      lowerCAmelCase_			:      Any			=   depths
      lowerCAmelCase_			:      Optional[int]			=   is_training
      lowerCAmelCase_			:      Union[str, Any]			=   use_labels
      lowerCAmelCase_			:      Union[str, Any]			=   hidden_act
      lowerCAmelCase_			:      int			=   num_labels
      lowerCAmelCase_			:      Optional[Any]			=   scope
      lowerCAmelCase_			:      Optional[Any]			=   len(lowerCamelCase		)

    def __lowercase   (   self    :  Any		)   ->  List[str]:
      lowerCAmelCase_			:      int			=   floats_tensor([self.batch_size, self.num_channels, self.image_size, self.image_size]		)

      lowerCAmelCase_			:      List[Any]			=   None
      if self.use_labels:
        lowerCAmelCase_			:      Optional[int]			=   ids_tensor([self.batch_size]    ,						self.num_labels		)

      lowerCAmelCase_			:      Tuple			=   self.get_config()

      return config, pixel_values, labels

    def __lowercase   (   self    :  str		)   ->  List[Any]:
      return ResNetConfig(
          num_channels=self.num_channels    ,						embeddings_size=self.embeddings_size    ,						hidden_sizes=self.hidden_sizes    ,						depths=self.depths    ,						hidden_act=self.hidden_act    ,						num_labels=self.num_labels    ,						image_size=self.image_size    ,						)

    def __lowercase   (   self    :  List[Any]    ,						lowerCamelCase    :  Tuple    ,						lowerCamelCase    :  int    ,						lowerCamelCase    :  int		)   ->  Tuple:
      lowerCAmelCase_			:      Dict			=   TFResNetModel(config=lowerCamelCase		)
      lowerCAmelCase_			:      Any			=   model(lowerCamelCase		)
      # expected last hidden states: B, C, H // 32, W // 32
      self.parent.assertEqual(
          result.last_hidden_state.shape    ,						(self.batch_size, self.hidden_sizes[-1], self.image_size // 32, self.image_size // 32)    ,						)

    def __lowercase   (   self    :  Any    ,						lowerCamelCase    :  List[Any]    ,						lowerCamelCase    :  Optional[int]    ,						lowerCamelCase    :  Optional[Any]		)   ->  Tuple:
      lowerCAmelCase_			:      Dict			=   self.num_labels
      lowerCAmelCase_			:      Dict			=   TFResNetForImageClassification(lowerCamelCase		)
      lowerCAmelCase_			:      Optional[int]			=   model(lowerCamelCase    ,						labels=lowerCamelCase		)
      self.parent.assertEqual(result.logits.shape    ,						(self.batch_size, self.num_labels)		)





    def __lowercase   (   self    :  Optional[Any]		)   ->  int:
      lowerCAmelCase_			:      Dict			=   self.prepare_config_and_inputs()
      lowerCAmelCase_,							lowerCAmelCase_,							lowerCAmelCase_			:      Dict			=   config_and_inputs
      lowerCAmelCase_			:      Tuple			=   {"""pixel_values""": pixel_values}
      return config, inputs_dict







@require_tf
class    __snake_case       (   _SCREAMING_SNAKE_CASE	,_SCREAMING_SNAKE_CASE	,unittest.TestCase):







    """simple docstring"""



    lowercase    =					(TFResNetModel, TFResNetForImageClassification) if is_tf_available() else ()
    lowercase    =					(
        {'feature-extraction': TFResNetModel, 'image-classification': TFResNetForImageClassification}
        if is_tf_available()
        else {}
    )

    lowercase    =					False
    lowercase    =					False
    lowercase    =					False
    lowercase    =					False
    lowercase    =					False

    def __lowercase   (   self    :  List[Any]		)   ->  int:
      lowerCAmelCase_			:      List[Any]			=   TFResNetModelTester(self		)
      lowerCAmelCase_			:      Dict			=   ConfigTester(self    ,						config_class=lowerCamelCase    ,						has_text_modality=lowerCamelCase		)

    def __lowercase   (   self    :  int		)   ->  Optional[Any]:
      self.create_and_test_config_common_properties()
      self.config_tester.create_and_test_config_to_json_string()
      self.config_tester.create_and_test_config_to_json_file()
      self.config_tester.create_and_test_config_from_and_save_pretrained()
      self.config_tester.create_and_test_config_with_num_labels()
      self.config_tester.check_config_can_be_init_without_params()
      self.config_tester.check_config_arguments_init()

    def __lowercase   (   self    :  Dict		)   ->  List[Any]:
      return

    @unittest.skip(reason="""ResNet does not use inputs_embeds"""		)
    def __lowercase   (   self    :  Dict		)   ->  Tuple:
      pass

    @unittest.skip(reason="""ResNet does not support input and output embeddings"""		)
    def __lowercase   (   self    :  str		)   ->  int:
      pass

    def __lowercase   (   self    :  List[str]		)   ->  Any:
      lowerCAmelCase_,							lowerCAmelCase_			:      str			=   self.model_tester.prepare_config_and_inputs_for_common()

      for model_class in self.all_model_classes:
        lowerCAmelCase_			:      List[Any]			=   model_class(lowerCamelCase		)
        lowerCAmelCase_			:      Optional[int]			=   inspect.signature(model.call		)
        # signature.parameters is an OrderedDict => so arg_names order is deterministic
        lowerCAmelCase_			:      Optional[Any]			=   [*signature.parameters.keys()]

        lowerCAmelCase_			:      List[Any]			=   ["""pixel_values"""]
        self.assertListEqual(arg_names[:1]    ,						lowerCamelCase		)

    def __lowercase   (   self    :  List[str]		)   ->  Dict:
      lowerCAmelCase_			:      List[str]			=   self.model_tester.prepare_config_and_inputs()
      self.model_tester.create_and_check_model(*lowerCamelCase		)

    def __lowercase   (   self    :  Optional[Any]		)   ->  Dict:
      def check_hidden_states_output(lowerCamelCase    :  Any    ,						lowerCamelCase    :  str    ,						lowerCamelCase    :  Union[str, Any]		):
        lowerCAmelCase_			:      List[str]			=   model_class(lowerCamelCase		)
        lowerCAmelCase_			:      Optional[Any]			=   model(**self._prepare_for_class(lowerCamelCase    ,						lowerCamelCase		)		)

        lowerCAmelCase_			:      int			=   outputs.encoder_hidden_states if config.is_encoder_decoder else outputs.hidden_states

        lowerCAmelCase_			:      Dict			=   self.model_tester.num_stages
        self.assertEqual(len(lowerCamelCase		)    ,						expected_num_stages + 1		)

        # ResNet's feature maps are of shape (batch_size, num_channels, height, width)
        self.assertListEqual(
            list(hidden_states[0].shape[-2:]		)    ,						[self.model_tester.image_size // 4, self.model_tester.image_size // 4]    ,						)

      lowerCAmelCase_,							lowerCAmelCase_			:      Optional[int]			=   self.model_tester.prepare_config_and_inputs_for_common()
      lowerCAmelCase_			:      Optional[int]			=   ["""basic""", """bottleneck"""]
      for model_class in self.all_model_classes:
        for layer_type in layers_type:
          lowerCAmelCase_			:      Optional[Any]			=   layer_type
          lowerCAmelCase_			:      Tuple			=   True
          check_hidden_states_output(lowerCamelCase    ,						lowerCamelCase    ,						lowerCamelCase		)

          # check that output_hidden_states also work using config
          del inputs_dict["output_hidden_states"]
          lowerCAmelCase_			:      Any			=   True

          check_hidden_states_output(lowerCamelCase    ,						lowerCamelCase    ,						lowerCamelCase		)

    def __lowercase   (   self    :  List[str]		)   ->  str:
      lowerCAmelCase_			:      Union[str, Any]			=   self.model_tester.prepare_config_and_inputs()
      self.model_tester.create_and_check_for_image_classification(*lowerCamelCase		)





    @slow
    def __lowercase   (   self    :  Tuple		)   ->  Optional[Any]:
      for model_name in TF_RESNET_PRETRAINED_MODEL_ARCHIVE_LIST[:1]:
        lowerCAmelCase_			:      str			=   TFResNetModel.from_pretrained(lowerCamelCase		)
        self.assertIsNotNone(lowerCamelCase		)







def 				UpperCamelCase_			(    ):
  '''simple docstring'''





  lowerCAmelCase_			:      Union[str, Any]			=   Image.open("""./tests/fixtures/tests_samples/COCO/000000039769.png"""					)
  return image






@require_tf
@require_vision
class    __snake_case       (   unittest.TestCase):







    """simple docstring"""



    @cached_property
    def __lowercase   (   self    :  List[str]		)   ->  Dict:
      return (
          AutoImageProcessor.from_pretrained(TF_RESNET_PRETRAINED_MODEL_ARCHIVE_LIST[0]		)
          if is_vision_available()
          else None
      )





    @slow
    def __lowercase   (   self    :  Optional[Any]		)   ->  Optional[Any]:
      lowerCAmelCase_			:      Any			=   TFResNetForImageClassification.from_pretrained(TF_RESNET_PRETRAINED_MODEL_ARCHIVE_LIST[0]		)

      lowerCAmelCase_			:      Any			=   self.default_image_processor
      lowerCAmelCase_			:      Union[str, Any]			=   prepare_img()
      lowerCAmelCase_			:      List[str]			=   image_processor(images=lowerCamelCase    ,						return_tensors="""tf"""		)

      # forward pass
      lowerCAmelCase_			:      Tuple			=   model(**lowerCamelCase		)

      # verify the logits
      lowerCAmelCase_			:      Optional[int]			=   tf.TensorShape((1, 10_00)		)
      self.assertEqual(outputs.logits.shape    ,						lowerCamelCase		)

      lowerCAmelCase_			:      Tuple			=   tf.constant([-11.1_069, -9.7_877, -8.3_777]		)

      self.assertTrue(np.allclose(outputs.logits[0, :3].numpy()    ,						lowerCamelCase    ,						atol=1E-4		)		)







'''simple docstring'''






def 				UpperCamelCase_			(    A__					:   int = 1_00					):
  '''simple docstring'''





  lowerCAmelCase_			:      int			=   set()

  lowerCAmelCase_			:      Tuple			=   0

  lowerCAmelCase_			:      str			=   n + 1  # maximum limit

  for a in range(2							,    A__					):
    for b in range(2							,    A__					):
      lowerCAmelCase_			:      str			=   a**b  # calculates the current power
      collect_powers.add(A__					)  # adds the result to the set
  return len(A__					)


if __name__ == "__main__":
  print("Number of terms ", solution(int(str(input()).strip())))



