


from math import sqrt




def 						__SCREAMING_SNAKE_CASE       (					lowercase_			)		->    int:




						'''simple docstring'''







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




def 						__SCREAMING_SNAKE_CASE       (					lowercase_ = 10000			)		->    int:




						'''simple docstring'''







						__UpperCAmelCase :       Tuple  						=  sum(
						    i
						    for i in range(1			,					lowercase_			)
						    if sum_of_divisors(sum_of_divisors(lowercase_			)			) == i and sum_of_divisors(lowercase_			) != i			)
						return total


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





import copy
from dataclasses import dataclass
from pathlib import Path
from typing import Dict, Optional, Union




@dataclass
class        lowerCamelCase      :
	_lowerCAmelCase    :		Optional[Union[str, Path]]        =	None
	_lowerCAmelCase    :		bool        =	False
	_lowerCAmelCase    :		bool        =	False
	_lowerCAmelCase    :		bool        =	False
	_lowerCAmelCase    :		Optional[Dict]        =	None
	_lowerCAmelCase    :		Optional[str]        =	None
	_lowerCAmelCase    :		bool        =	False
	_lowerCAmelCase    :		bool        =	False
	_lowerCAmelCase    :		bool        =	False
	_lowerCAmelCase    :		bool        =	True
	_lowerCAmelCase    :		Optional[int]        =	None
	_lowerCAmelCase    :		int        =	1
	_lowerCAmelCase    :		Optional[Union[str, bool]]        =	None
	_lowerCAmelCase    :		bool        =	False
	_lowerCAmelCase    :		Optional[Dict]        =	None
	_lowerCAmelCase    :		Optional[str]        =	None


	def    A(						self):
							return self.__class__(**{k: copy.deepcopy(lowercase__) for k, v in self.__dict__.items()})

