"""simple docstring"""






import os

from huggingface_hub.constants import HUGGINGFACE_HUB_CACHE, hf_cache_home


_A        =     HUGGINGFACE_HUB_CACHE


_A        =     'config.json'
_A        =     'diffusion_pytorch_model.bin'
_A        =     'diffusion_flax_model.msgpack'
_A        =     'model.onnx'
_A        =     'diffusion_pytorch_model.safetensors'
_A        =     'weights.pb'
_A        =     'https://huggingface.co'
_A        =     default_cache_path
_A        =     'diffusers_modules'
_A        =     os.getenv('HF_MODULES_CACHE', os.path.join(hf_cache_home, 'modules'))
_A        =     ['fp16', 'non-ema']
_A        =     '.self_attn'











'''simple docstring'''




from math import sqrt



def 		__A		(  lowerCamelCase_	):


		"""simple docstring"""



		SCREAMING_SNAKE_CASE :				str		=			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 		__A		(  lowerCamelCase_ = 1_00_00	):


		"""simple docstring"""



		SCREAMING_SNAKE_CASE :				str		=			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())))



