





from math import sqrt




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




def 				_lowerCAmelCase  (			lowerCamelCase_     :					int = 1_0_0_0_0			):
			__lowercase			  =							sum(
			    i
			    for i in range(1						,    lowerCamelCase_			)
			    if sum_of_divisors(sum_of_divisors(lowerCamelCase_			)			) == i and sum_of_divisors(lowerCamelCase_			) != i			)
			return total


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












'''simple docstring'''



def 				_lowerCAmelCase  (			lowerCamelCase_     :					int = 6_0_0_8_5_1_4_7_5_1_4_3			):

			try:
						__lowercase			  =							int(lowerCamelCase_			)
			except (TypeError, ValueError):
						raise TypeError('''Parameter n must be int or castable to int.'''			)
			if n <= 0:
						raise ValueError('''Parameter n must be greater than or equal to one.'''			)
			__lowercase			  =							1
			__lowercase			  =							2
			while i * i <= n:
						while n % i == 0:
									__lowercase			  =							i
									n //= i
						i += 1
			if n > 1:
						__lowercase			  =							n
			return int(lowerCamelCase_			)


if __name__ == "__main__":
	print(f'''{solution() = }''')





