
'''simple docstring'''



from __future__ import annotations

_SCREAMING_SNAKE_CASE   =      1_0




def 				_lowerCAmelCase  (			lowerCamelCase_     :					list[int]			):
			__lowercase			  =							1
			__lowercase			  =							max(lowerCAmelCase__			)
			while placement <= max_digit:
						# declare and initialize empty buckets
						__lowercase			  =							[[] for _ in range(lowerCAmelCase__			)]
						# split list_of_ints between the buckets
						for i in list_of_ints:
									__lowercase			  =							int((i / placement) % RADIX			)
									buckets[tmp].append(lowerCAmelCase__			)
						# put each buckets' contents into list_of_ints
						__lowercase			  =							0
						for b in range(lowerCAmelCase__			):
									for i in buckets[b]:
												__lowercase			  =							i
												a += 1
        # move to next
						placement *= RADIX
			return list_of_ints


if __name__ == "__main__":
	import doctest

	doctest.testmod()












'''simple docstring'''



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())))





