




from math import sqrt




def 			__magic_name__				( A		:					int   ):






			'''simple docstring'''







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




def 			__magic_name__				( A		:					int = 10000   ):






			'''simple docstring'''







			a    =			sum(
			    i
			    for i in range(1,  A   )
			    if sum_of_divisors(sum_of_divisors(A   )   ) == i and sum_of_divisors(A   ) != i   )
			return total


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







'''simple docstring'''

import re

from filelock import FileLock


try:
 import nltk

 _A			:      int					      =				True
except (ImportError, ModuleNotFoundError):
 _A			:      Optional[Any]					      =				False

if NLTK_AVAILABLE:
 with FileLock('''.lock''') as lock:
  nltk.download('''punkt''', quiet=True)







def      UpperCamelCase_						(					snake_case_       :       str      )					->     str:






 '''simple docstring'''

 re.sub("""<n>"""						,		""""""						,		snake_case_      )  # remove pegasus newline char
 assert NLTK_AVAILABLE, "nltk must be installed to separate newlines between sentences. (pip install nltk)"
 return "\n".join(nltk.sent_tokenize(snake_case_      )      )






