


"""simple docstring"""






from __future__ import annotations


class 			lowerCamelCase_		:





				"""simple docstring"""







				def __init__(						self       ,		UpperCAmelCase__     ):
								SCREAMING_SNAKE_CASE__     							=				data
								SCREAMING_SNAKE_CASE__     							=				None
								SCREAMING_SNAKE_CASE__     							=				None


def __lowercase     (      lowerCamelCase_  :      Node | None  ):  # In Order traversal of the tree
				if tree:
								display(tree.left  )
								print(tree.data  )
								display(tree.right  )


def __lowercase     (      lowerCamelCase_  :      Node | None  ):
				return 1 + max(depth_of_tree(tree.left  )						,					depth_of_tree(tree.right  )  ) if tree else 0


def __lowercase     (      lowerCamelCase_  :      Node  ):
				if not tree:
								return True
				if tree.left and tree.right:
								return is_full_binary_tree(tree.left  ) and is_full_binary_tree(tree.right  )
				else:
								return not tree.left and not tree.right


def __lowercase     (      ):  # Main function for testing.
				SCREAMING_SNAKE_CASE__     							=				Node(1  )
				SCREAMING_SNAKE_CASE__     							=				Node(2  )
				SCREAMING_SNAKE_CASE__     							=				Node(3  )
				SCREAMING_SNAKE_CASE__     							=				Node(4  )
				SCREAMING_SNAKE_CASE__     							=				Node(5  )
				SCREAMING_SNAKE_CASE__     							=				Node(6  )
				SCREAMING_SNAKE_CASE__     							=				Node(7  )
				SCREAMING_SNAKE_CASE__     							=				Node(8  )
				SCREAMING_SNAKE_CASE__     							=				Node(9  )

				print(is_full_binary_tree(lowerCamelCase_  )  )
				print(depth_of_tree(lowerCamelCase_  )  )
				print("Tree is: "  )
				display(lowerCamelCase_  )


if __name__ == "__main__":
	main()




"""simple docstring"""






from math import sqrt


def __lowercase     (      lowerCamelCase_  :      int  ):
				SCREAMING_SNAKE_CASE__     							=				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 __lowercase     (      lowerCamelCase_  :      int = 10000  ):
				SCREAMING_SNAKE_CASE__     							=				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())))
