from argparse import ArgumentParser

from accelerate.commands.config import get_config_parser
from accelerate.commands.env import env_command_parser
from accelerate.commands.launch import launch_command_parser
from accelerate.commands.test import test_command_parser
from accelerate.commands.tpu import tpu_command_parser
def 							lowerCAmelCase(     ):
					__a		 =       ArgumentParser('Accelerate CLI tool'				,    usage='accelerate <command> [<args>]'				,    allow_abbrev=__a						)
					__a		 =       parser.add_subparsers(help='accelerate command helpers'						)

					# Register commands
					get_config_parser(subparsers=__a						)
					env_command_parser(subparsers=__a						)
					launch_command_parser(subparsers=__a						)
					tpu_command_parser(subparsers=__a						)
					test_command_parser(subparsers=__a						)

					# Let's go
					__a		 =       parser.parse_args()

					if not hasattr(__a				,    'func'						):
										parser.print_help()
										exit(1						)

					# Run
					args.func(__a						)


if __name__ == "__main__":
	main()





from math import sqrt
def 							lowerCAmelCase(     __lowerCamelCase						):
					__a		 =       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 = 1_0000						):
					__a		 =       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())))




