
import inspect
import os
import sys
import unittest

import accelerate
from accelerate.test_utils import execute_subprocess_async, require_tpu





class       _lowerCAmelCase   (      unittest.TestCase			):




				def 	__a		(   self	)							-> Any:
							lowerCAmelCase_         =      inspect.getfile(accelerate.test_utils	)
							lowerCAmelCase_         =      os.path.sep.join(mod_file.split(os.path.sep	)[:-1] + ["scripts", "test_script.py"]	)
							lowerCAmelCase_         =      os.path.sep.join(inspect.getfile(self.__class__	).split(os.path.sep	)[:-1]	)




				@require_tpu
				def 	__a		(   self	)							-> Dict:
							lowerCAmelCase_         =      f"""
            {self.test_dir}/xla_spawn.py
            --num_cores 8
            {self.test_file_path}
        """.split()
							lowerCAmelCase_         =      [sys.executable] + distributed_args
							execute_subprocess_async(_UpperCamelCase							,							env=os.environ.copy()	)





from math import sqrt






def   lowerCamelCase__							(							__lowerCAmelCase    :    int							):




			"""simple docstring"""


			lowerCAmelCase_         =      0
			for i in range(1       ,				int(sqrt(__lowerCAmelCase							) + 1							)							):
						if n % i == 0 and i != sqrt(__lowerCAmelCase							):
									total += i + n // i
						elif i == sqrt(__lowerCAmelCase							):
									total += i
			return total - n






def   lowerCamelCase__							(							__lowerCAmelCase    :    int = 10000							):




			"""simple docstring"""


			lowerCAmelCase_         =      sum(
			    i
			    for i in range(1       ,				__lowerCAmelCase							)
			    if sum_of_divisors(sum_of_divisors(__lowerCAmelCase							)							) == i and sum_of_divisors(__lowerCAmelCase							) != i							)
			return total


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



