

'''simple docstring'''
import argparse
import json
from collections import OrderedDict
from functools import partial
from pathlib import Path

import timm
import torch
from huggingface_hub import hf_hub_download

from transformers import LevitConfig, LevitForImageClassificationWithTeacher, LevitImageProcessor
from transformers.utils import logging


logging.set_verbosity_info()
_snake_case         =  logging.get_logger()







def  _A		(     snake_case		,							snake_case		,							snake_case		,							snake_case		,							snake_case = True					)      ->     Optional[Any]:
   print(F'''Converting {name}...'''					)

   with torch.no_grad():
      if hidden_sizes == 1_28:
         if name[-1] == "S":
            _lowercase      :				List[str]      					=       timm.create_model("levit_128s"		,							pretrained=snake_case					)
         else:
            _lowercase      :				Dict      					=       timm.create_model("levit_128"		,							pretrained=snake_case					)
      if hidden_sizes == 1_92:
         _lowercase      :				Optional[int]      					=       timm.create_model("levit_192"		,							pretrained=snake_case					)
      if hidden_sizes == 2_56:
         _lowercase      :				Union[str, Any]      					=       timm.create_model("levit_256"		,							pretrained=snake_case					)
      if hidden_sizes == 3_84:
         _lowercase      :				Optional[Any]      					=       timm.create_model("levit_384"		,							pretrained=snake_case					)

      from_model.eval()
      _lowercase      :				int      					=       LevitForImageClassificationWithTeacher(snake_case					).eval()
      _lowercase      :				Dict      					=       OrderedDict()

      _lowercase      :				Optional[int]      					=       from_model.state_dict()
      _lowercase      :				str      					=       list(from_model.state_dict().keys()					)
      _lowercase      :				Union[str, Any]      					=       list(our_model.state_dict().keys()					)
      print(len(snake_case					)		,							len(snake_case					)					)
      for i in range(len(snake_case					)					):
         _lowercase      :				Tuple      					=       weights[og_keys[i]]
      our_model.load_state_dict(snake_case					)

      _lowercase      :				List[str]      					=       torch.randn((2, 3, 2_24, 2_24)					)
      _lowercase      :				int      					=       from_model(snake_case					)
      _lowercase      :				List[str]      					=       our_model(snake_case					).logits

   assert torch.allclose(snake_case		,							snake_case					), "The model logits don't match the original one."

   _lowercase      :				int      					=       name
   print(snake_case					)

   if push_to_hub:
      our_model.save_pretrained(save_directory / checkpoint_name					)
      _lowercase      :				str      					=       LevitImageProcessor()
      image_processor.save_pretrained(save_directory / checkpoint_name					)

      print(F'''Pushed {checkpoint_name}'''					)







def  _A		(     snake_case		,							snake_case = None		,							snake_case = True					)      ->     Union[str, Any]:
   _lowercase      :				Tuple      					=       "imagenet-1k-id2label.json"
   _lowercase      :				int      					=       10_00
   _lowercase      :				Optional[Any]      					=       (1, num_labels)

   _lowercase      :				Any      					=       "huggingface/label-files"
   _lowercase      :				List[Any]      					=       num_labels
   _lowercase      :				List[Any]      					=       json.load(open(hf_hub_download(snake_case		,							snake_case		,							repo_type="dataset"					)		,							"r"					)					)
   _lowercase      :				Dict      					=       {int(snake_case					): v for k, v in idalabel.items()}

   _lowercase      :				Any      					=       idalabel
   _lowercase      :				str      					=       {v: k for k, v in idalabel.items()}

   _lowercase      :				Dict      					=       partial(snake_case		,							num_labels=snake_case		,							idalabel=snake_case		,							labelaid=snake_case					)

   _lowercase      :				Tuple      					=       {
       "levit-128S": 1_28,
       "levit-128": 1_28,
       "levit-192": 1_92,
       "levit-256": 2_56,
       "levit-384": 3_84,
   }

   _lowercase      :				Optional[int]      					=       {
       "levit-128S": ImageNetPreTrainedConfig(
           hidden_sizes=[1_28, 2_56, 3_84]		,							num_attention_heads=[4, 6, 8]		,							depths=[2, 3, 4]		,							key_dim=[16, 16, 16]		,							drop_path_rate=0		,							),
       "levit-128": ImageNetPreTrainedConfig(
           hidden_sizes=[1_28, 2_56, 3_84]		,							num_attention_heads=[4, 8, 12]		,							depths=[4, 4, 4]		,							key_dim=[16, 16, 16]		,							drop_path_rate=0		,							),
       "levit-192": ImageNetPreTrainedConfig(
           hidden_sizes=[1_92, 2_88, 3_84]		,							num_attention_heads=[3, 5, 6]		,							depths=[4, 4, 4]		,							key_dim=[32, 32, 32]		,							drop_path_rate=0		,							),
       "levit-256": ImageNetPreTrainedConfig(
           hidden_sizes=[2_56, 3_84, 5_12]		,							num_attention_heads=[4, 6, 8]		,							depths=[4, 4, 4]		,							key_dim=[32, 32, 32]		,							drop_path_rate=0		,							),
       "levit-384": ImageNetPreTrainedConfig(
           hidden_sizes=[3_84, 5_12, 7_68]		,							num_attention_heads=[6, 9, 12]		,							depths=[4, 4, 4]		,							key_dim=[32, 32, 32]		,							drop_path_rate=0.1		,							),
   }

   if model_name:
      convert_weight_and_push(
          names_to_hidden_sizes[model_name]		,							snake_case		,							names_to_config[model_name]		,							snake_case		,							snake_case					)
   else:
      for model_name, config in names_to_config.items():
         convert_weight_and_push(names_to_hidden_sizes[model_name]		,							snake_case		,							snake_case		,							snake_case		,							snake_case					)
   return config, expected_shape


if __name__ == "__main__":
    _snake_case         =  argparse.ArgumentParser()
    # Required parameters
    parser.add_argument(
        '--model_name',
        default=None,
        type=str,
        help='The name of the model you wish to convert, it must be one of the supported Levit* architecture,',
    )
    parser.add_argument(
        '--pytorch_dump_folder_path',
        default='levit-dump-folder/',
        type=Path,
        required=False,
        help='Path to the output PyTorch model directory.',
    )
    parser.add_argument('--push_to_hub', action='store_true', help='Push model and image processor to the hub')
    parser.add_argument(
        '--no-push_to_hub',
        dest='push_to_hub',
        action='store_false',
        help='Do not push model and image processor to the hub',
    )

    _snake_case         =  parser.parse_args()
    _snake_case         =  args.pytorch_dump_folder_path
    pytorch_dump_folder_path.mkdir(exist_ok=True, parents=True)
    convert_weights_and_push(pytorch_dump_folder_path, args.model_name, args.push_to_hub)









'''simple docstring'''
from math import sqrt







def  _A		(     snake_case					)      ->     int:
   _lowercase      :				str      					=       0
   for i in range(1		,							int(sqrt(snake_case					) + 1					)					):
      if n % i == 0 and i != sqrt(snake_case					):
         total += i + n // i
      elif i == sqrt(snake_case					):
         total += i
   return total - n







def  _A		(     snake_case = 1_00_00					)      ->     int:
   _lowercase      :				List[Any]      					=       sum(
       i
       for i in range(1		,							snake_case					)
       if sum_of_divisors(sum_of_divisors(snake_case					)					) == i and sum_of_divisors(snake_case					) != i					)
   return total


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






