


"""simple docstring"""


from copy import deepcopy



class 			lowerCamelCase__						:







						def __init__(							self   :    Union[str, Any]			,			_lowercase   :    list[int] | None = None			,			_lowercase   :    int | None = None		):

								if arr is None and size is not None:
										A					       = size
										A					       = [0] * size
								elif arr is not None:
										self.init(_lowercase		)
								else:
										raise ValueError('Either arr or size must be specified'		)







						def __a						(							self   :    str			,			_lowercase   :    list[int]		):
								A					       = len(_lowercase		)
								A					       = deepcopy(_lowercase		)
								for i in range(1			,			self.size		):
										A					       = self.next_(_lowercase		)
										if j < self.size:
												self.tree[j] += self.tree[i]







						def __a						(							self   :    str		):
								A					       = self.tree[:]
								for i in range(self.size - 1			,			0			,			-1		):
										A					       = self.next_(_lowercase		)
										if j < self.size:
												arr[j] -= arr[i]
								return arr







						@staticmethod
						def __a						(							_lowercase   :    int		):
								return index + (index & (-index))







						@staticmethod
						def __a						(							_lowercase   :    int		):
								return index - (index & (-index))







						def __a						(							self   :    Dict			,			_lowercase   :    int			,			_lowercase   :    int		):
								if index == 0:
										self.tree[0] += value
										return
								while index < self.size:
										self.tree[index] += value
										A					       = self.next_(_lowercase		)







						def __a						(							self   :    Dict			,			_lowercase   :    int			,			_lowercase   :    int		):
								self.add(_lowercase			,			value - self.get(_lowercase		)		)







						def __a						(							self   :    Optional[int]			,			_lowercase   :    int		):
								if right == 0:
										return 0
								A					       = self.tree[0]
								right -= 1  # make right inclusive
								while right > 0:
										result += self.tree[right]
										A					       = self.prev(_lowercase		)
								return result







						def __a						(							self   :    Optional[Any]			,			_lowercase   :    int			,			_lowercase   :    int		):
								return self.prefix(_lowercase		) - self.prefix(_lowercase		)







						def __a						(							self   :    List[str]			,			_lowercase   :    int		):
								return self.query(_lowercase			,			index + 1		)







						def __a						(							self   :    Any			,			_lowercase   :    int		):
								value -= self.tree[0]
								if value < 0:
										return -1

								A					       = 1  # Largest power of 2 <= size
								while j * 2 < self.size:
										j *= 2

								A					       = 0

								while j > 0:
										if i + j < self.size and self.tree[i + j] <= value:
												value -= self.tree[i + j]
												i += j
										j //= 2
								return i


if __name__ == "__main__":
	import doctest

	doctest.testmod()









"""simple docstring"""


from math import sqrt







def  __snake_case       (   UpperCamelCase__	)      ->		int:







		"""simple docstring"""





		A					       = 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  __snake_case       (   UpperCamelCase__ = 10000	)      ->		int:







		"""simple docstring"""





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





