
'''simple docstring'''
class       _lowerCAmelCase   :







       '''simple docstring'''

       def __init__(self  ,  UpperCAmelCase  )					->       None:
              _snake_case       =  set_counts
              _snake_case       =  max(UpperCAmelCase  )
              _snake_case       =  len(UpperCAmelCase  )
              _snake_case       =  [1] * num_sets
              _snake_case       =  list(range(UpperCAmelCase  )  )

       def 	lowercase							(self  ,  UpperCAmelCase  ,  UpperCAmelCase  )					->       bool:
              _snake_case       =  self.get_parent(UpperCAmelCase  )
              _snake_case       =  self.get_parent(UpperCAmelCase  )

              if src_parent == dst_parent:
                     return False

              if self.ranks[dst_parent] >= self.ranks[src_parent]:
                     self.set_counts[dst_parent] += self.set_counts[src_parent]
                     _snake_case       =  0
                     _snake_case       =  dst_parent
                     if self.ranks[dst_parent] == self.ranks[src_parent]:
                            self.ranks[dst_parent] += 1
                     _snake_case       =  self.set_counts[dst_parent]
              else:
                     self.set_counts[src_parent] += self.set_counts[dst_parent]
                     _snake_case       =  0
                     _snake_case       =  src_parent
                     _snake_case       =  self.set_counts[src_parent]

              _snake_case       =  max(self.max_set  ,  UpperCAmelCase  )
              return True





       def 	lowercase							(self  ,  UpperCAmelCase  )					->       int:
              if self.parents[disj_set] == disj_set:
                     return disj_set
              _snake_case       =  self.get_parent(self.parents[disj_set]  )
              return self.parents[disj_set]

'''simple docstring'''
from math import sqrt






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






def  __SCREAMING_SNAKE_CASE				(  _SCREAMING_SNAKE_CASE = 1_0000				):
							_snake_case       =  sum(
							    i
							    for i in range(1							, _SCREAMING_SNAKE_CASE				)
							    if sum_of_divisors(sum_of_divisors(_SCREAMING_SNAKE_CASE				)				) == i and sum_of_divisors(_SCREAMING_SNAKE_CASE				) != i				)
							return total


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