
"""simple docstring"""


from math import sqrt






def    _snake_case					(		snake_case__ :  int  ):
	A     = 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    _snake_case					(		snake_case__ :  int = 1_0000  ):
	A     = 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'''






def   UpperCamelCase__ (						lowerCAmelCase				,      lowerCAmelCase    ):





      """simple docstring"""


      _lowerCAmelCase					=				""""""
      for word_or_phrase in separated:
            if not isinstance(lowerCAmelCase				,      lowerCAmelCase    ):
                  raise Exception("""join() accepts only strings to be joined"""    )
            joined += word_or_phrase + separator
      return joined.strip(lowerCAmelCase    )


if __name__ == "__main__":
      from doctest import testmod

      testmod()






