'''simple docstring'''





from math import sqrt





def 	lowerCAmelCase_				(					snake_case_       : int			)    ->      int:


     '''simple docstring'''




     UpperCAmelCase_           =   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 	lowerCAmelCase_				(					snake_case_       : int = 1_00_00			)    ->      int:


     '''simple docstring'''




     UpperCAmelCase_           =   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())))










'''simple docstring'''







import os
from distutils.util import strtobool





def 						snake_case_							(_a	:							Union[str, Any]    ,   _a	:							List[Any]     ):
    for e in env_keys:
        UpperCAmelCase			       =		int(os.environ.get(_a    ,   -1     )     )
        if val >= 0:
            return val
    return default





def 						snake_case_							(_a	:							Dict    ,   _a	:							Any=False     ):
    UpperCAmelCase			       =		os.environ.get(_a    ,   str(_a     )     )
    return strtobool(_a     ) == 1  # As its name indicates `strtobool` actually returns an int...







def 						snake_case_							(_a	:							str    ,   _a	:							Optional[Any]="no"     ):
    UpperCAmelCase			       =		os.environ.get(_a    ,   str(_a     )     )
    return value




