






'''simple docstring'''
from math import sqrt





def 	_a(					UpperCamelCase__			:  int							):




      '''simple docstring'''






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





def 	_a(					UpperCamelCase__			:  int = 1_0_0_0_0							):




      '''simple docstring'''






      SCREAMING_SNAKE_CASE__       :			int													=sum(
          i
          for i in range(1,		UpperCamelCase__							)
          if sum_of_divisors(sum_of_divisors(UpperCamelCase__							)							) == i and sum_of_divisors(UpperCamelCase__							) != i							)
      return total


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







'''simple docstring'''
import math





def 	_a(					UpperCamelCase__			:  int							):




      '''simple docstring'''






      return math.sqrt(UpperCamelCase__							) * math.sqrt(UpperCamelCase__							) == num





def 	_a(					UpperCamelCase__			:  int							):




      '''simple docstring'''






      SCREAMING_SNAKE_CASE__       :			List[Any]													=0
      SCREAMING_SNAKE_CASE__       :			Any													=n
      while left <= right:
            SCREAMING_SNAKE_CASE__       :			str													=(left + right) // 2
            if mid**2 == n:
                  return True
            elif mid**2 > n:
                  SCREAMING_SNAKE_CASE__       :			Optional[Any]													=mid - 1
            else:
                  SCREAMING_SNAKE_CASE__       :			Tuple													=mid + 1
      return False


if __name__ == "__main__":
  import doctest

  doctest.testmod()