from __future__ import annotations

from collections.abc import Callable
from typing import Any, Generic, TypeVar

lowerCamelCase_    :		Dict							=	TypeVar("""T""")


class 						a__							(       Generic[T]		):



			def __init__(						self				,						UpperCAmelCase				,						UpperCAmelCase   )			->   None:
								__a		 =       None

								__a		 =       len(UpperCAmelCase   )
								__a		 =       [any_type for _ in range(self.N   )] + arr
								__a		 =       fnc
								self.build()



			def __SCREAMING_SNAKE_CASE							(						self   )			->   None:
								for p in range(self.N - 1				,						0				,						-1   ):
													__a		 =       self.fn(self.st[p * 2]				,						self.st[p * 2 + 1]   )



			def __SCREAMING_SNAKE_CASE							(						self				,						UpperCAmelCase				,						UpperCAmelCase   )			->   None:
								p += self.N
								__a		 =       v
								while p > 1:
													__a		 =       p // 2
													__a		 =       self.fn(self.st[p * 2]				,						self.st[p * 2 + 1]   )







			def __SCREAMING_SNAKE_CASE							(						self				,						UpperCAmelCase				,						UpperCAmelCase   )			->   T | None:  # noqa: E741
								__a ,				__a		 =       l + self.N, r + self.N

								__a		 =       None
								while l <= r:
													if l % 2 == 1:
																		__a		 =       self.st[l] if res is None else self.fn(UpperCAmelCase				,						self.st[l]   )
													if r % 2 == 0:
																		__a		 =       self.st[r] if res is None else self.fn(UpperCAmelCase				,						self.st[r]   )
													__a ,				__a		 =       (l + 1) // 2, (r - 1) // 2
								return res


if __name__ == "__main__":
	from functools import reduce

	lowerCamelCase_    :		Optional[int]							=	[1, 10, -2, 9, -3, 8, 4, -7, 5, 6, 11, -12]

	lowerCamelCase_    :		Any							=	{
	    0: 7,
	    1: 2,
	    2: 6,
	    3: -14,
	    4: 5,
	    5: 4,
	    6: 7,
	    7: -10,
	    8: 9,
	    9: 10,
	    10: 12,
	    11: 1,
	}

	lowerCamelCase_    :		Dict							=	SegmentTree(test_array, min)
	lowerCamelCase_    :		Optional[int]							=	SegmentTree(test_array, max)
	lowerCamelCase_    :		List[Any]							=	SegmentTree(test_array, lambda a, b: a + b)
	def 							lowerCAmelCase(     ):
						for i in range(len(__lowerCamelCase						)						):
											for j in range(__lowerCamelCase				,    len(__lowerCamelCase						)						):
																__a		 =       reduce(__lowerCamelCase				,    test_array[i : j + 1]						)
																__a		 =       reduce(__lowerCamelCase				,    test_array[i : j + 1]						)
																__a		 =       reduce(lambda __lowerCamelCase				,    __lowerCamelCase						: a + b				,    test_array[i : j + 1]						)
																assert min_range == min_segment_tree.query(__lowerCamelCase				,    __lowerCamelCase						)
																assert max_range == max_segment_tree.query(__lowerCamelCase				,    __lowerCamelCase						)
																assert sum_range == sum_segment_tree.query(__lowerCamelCase				,    __lowerCamelCase						)

	test_all_segments()

	for index, value in test_updates.items():
		lowerCamelCase_    :		Optional[Any]							=	value
		min_segment_tree.update(index, value)
		max_segment_tree.update(index, value)
		sum_segment_tree.update(index, value)
		test_all_segments()





from math import sqrt
def 							lowerCAmelCase(     __lowerCamelCase						):
					__a		 =       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 = 1_0000						):
					__a		 =       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())))




