






"""simple docstring"""

from math import sqrt

def 						__lowerCamelCase      (    __UpperCamelCase			)		->       int:

		"""simple docstring"""







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

def 						__lowerCamelCase      (    __UpperCamelCase = 10000			)		->       int:

		"""simple docstring"""







		lowerCAmelCase_  :				List[str]   							=     sum(
		    i
		    for i in range(1 ,			__SCREAMING_SNAKE_CASE			)
		    if sum_of_divisors(sum_of_divisors(__SCREAMING_SNAKE_CASE			)			) == i and sum_of_divisors(__SCREAMING_SNAKE_CASE			) != i			)
		return total


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






'''simple docstring'''






import functools






def 		UpperCamelCase__      (		__SCREAMING_SNAKE_CASE				,      __SCREAMING_SNAKE_CASE		)    ->   int:
      snake_case__       :   Any	      =    len(__SCREAMING_SNAKE_CASE		)
      snake_case__       :   List[str]	      =    len(__SCREAMING_SNAKE_CASE		)

      @functools.cache
      def min_distance(__SCREAMING_SNAKE_CASE				,      __SCREAMING_SNAKE_CASE		) -> int:
            # if first word index is overflow - delete all from the second word
            if indexa >= len_worda:
                  return len_worda - indexa
            # if second word index is overflow - delete all from the first word
            if indexa >= len_worda:
                  return len_worda - indexa
            snake_case__       :   Union[str, Any]	      =    int(worda[indexa] != worda[indexa]		)  # current letters not identical
            return min(
                1 + min_distance(indexa + 1				,      __SCREAMING_SNAKE_CASE		)				,      1 + min_distance(__SCREAMING_SNAKE_CASE				,      indexa + 1		)				,      diff + min_distance(indexa + 1				,      indexa + 1		)				,      )

      return min_distance(0				,      0		)


if __name__ == "__main__":
      import doctest

      doctest.testmod()
