
'''simple docstring'''
from __future__ import annotations

import math
import random
from typing import Any


class       _lowerCAmelCase   :







       '''simple docstring'''

       def __init__(self  )					->       None:
              _snake_case       =  []
              _snake_case       =  0
              _snake_case       =  0

       def 	lowercase							(self  )					->       bool:
              return self.head == self.tail

       def 	lowercase							(self  ,  UpperCAmelCase  )					->       None:
              self.data.append(UpperCAmelCase  )
              _snake_case       =  self.tail + 1

       def 	lowercase							(self  )					->       Any:
              _snake_case       =  self.data[self.head]
              _snake_case       =  self.head + 1
              return ret

       def 	lowercase							(self  )					->       int:
              return self.tail - self.head





       def 	lowercase							(self  )					->       None:
              print(self.data  )
              print("""**************"""  )
              print(self.data[self.head : self.tail]  )


class       _lowerCAmelCase   :







       '''simple docstring'''

       def __init__(self  ,  UpperCAmelCase  )					->       None:
              _snake_case       =  data
              _snake_case       =  None
              _snake_case       =  None
              _snake_case       =  1

       def 	lowercase							(self  )					->       Any:
              return self.data

       def 	lowercase							(self  )					->       MyNode | None:
              return self.left

       def 	lowercase							(self  )					->       MyNode | None:
              return self.right

       def 	lowercase							(self  )					->       int:
              return self.height

       def 	lowercase							(self  ,  UpperCAmelCase  )					->       None:
              _snake_case       =  data

       def 	lowercase							(self  ,  UpperCAmelCase  )					->       None:
              _snake_case       =  node

       def 	lowercase							(self  ,  UpperCAmelCase  )					->       None:
              _snake_case       =  node





       def 	lowercase							(self  ,  UpperCAmelCase  )					->       None:
              _snake_case       =  height






def  __SCREAMING_SNAKE_CASE				(  _SCREAMING_SNAKE_CASE				):





       if node is None:
              return 0
       return node.get_height()






def  __SCREAMING_SNAKE_CASE				(  _SCREAMING_SNAKE_CASE							, _SCREAMING_SNAKE_CASE				):





       if a > b:
              return a
       return b






def  __SCREAMING_SNAKE_CASE				(  _SCREAMING_SNAKE_CASE				):
       print("""left rotation node:"""							, node.get_data()				)
       _snake_case       =  node.get_left()
       assert ret is not None
       node.set_left(ret.get_right()				)
       ret.set_right(A__				)
       _snake_case       =  my_max(get_height(node.get_right()				)							, get_height(node.get_left()				)				) + 1
       node.set_height(A__				)
       _snake_case       =  my_max(get_height(ret.get_right()				)							, get_height(ret.get_left()				)				) + 1
       ret.set_height(A__				)
       return ret






def  __SCREAMING_SNAKE_CASE				(  _SCREAMING_SNAKE_CASE				):
       print("""right rotation node:"""							, node.get_data()				)
       _snake_case       =  node.get_right()
       assert ret is not None
       node.set_right(ret.get_left()				)
       ret.set_left(A__				)
       _snake_case       =  my_max(get_height(node.get_right()				)							, get_height(node.get_left()				)				) + 1
       node.set_height(A__				)
       _snake_case       =  my_max(get_height(ret.get_right()				)							, get_height(ret.get_left()				)				) + 1
       ret.set_height(A__				)
       return ret






def  __SCREAMING_SNAKE_CASE				(  _SCREAMING_SNAKE_CASE				):
       _snake_case       =  node.get_left()
       assert left_child is not None
       node.set_left(left_rotation(A__				)				)
       return right_rotation(A__				)






def  __SCREAMING_SNAKE_CASE				(  _SCREAMING_SNAKE_CASE				):
       _snake_case       =  node.get_right()
       assert right_child is not None
       node.set_right(right_rotation(A__				)				)
       return left_rotation(A__				)






def  __SCREAMING_SNAKE_CASE				(  _SCREAMING_SNAKE_CASE							, _SCREAMING_SNAKE_CASE				):





       if node is None:
              return MyNode(A__				)
       if data < node.get_data():
              node.set_left(insert_node(node.get_left()							, A__				)				)
              if (
                  get_height(node.get_left()				) - get_height(node.get_right()				) == 2
              ):  # an unbalance detected
                     _snake_case       =  node.get_left()
                     assert left_child is not None
                     if (
                         data < left_child.get_data()
                     ):  # new node is the left child of the left child
                            _snake_case       =  right_rotation(A__				)
                     else:
                            _snake_case       =  lr_rotation(A__				)
       else:
              node.set_right(insert_node(node.get_right()							, A__				)				)
              if get_height(node.get_right()				) - get_height(node.get_left()				) == 2:
                     _snake_case       =  node.get_right()
                     assert right_child is not None
                     if data < right_child.get_data():
                            _snake_case       =  rl_rotation(A__				)
                     else:
                            _snake_case       =  left_rotation(A__				)
       _snake_case       =  my_max(get_height(node.get_right()				)							, get_height(node.get_left()				)				) + 1
       node.set_height(A__				)
       return node






def  __SCREAMING_SNAKE_CASE				(  _SCREAMING_SNAKE_CASE				):





       while True:
              _snake_case       =  root.get_right()
              if right_child is None:
                     break
              _snake_case       =  right_child
       return root.get_data()






def  __SCREAMING_SNAKE_CASE				(  _SCREAMING_SNAKE_CASE				):





       while True:
              _snake_case       =  root.get_left()
              if left_child is None:
                     break
              _snake_case       =  left_child
       return root.get_data()






def  __SCREAMING_SNAKE_CASE				(  _SCREAMING_SNAKE_CASE							, _SCREAMING_SNAKE_CASE				):
       _snake_case       =  root.get_left()
       _snake_case       =  root.get_right()
       if root.get_data() == data:
              if left_child is not None and right_child is not None:
                     _snake_case       =  get_left_most(A__				)
                     root.set_data(A__				)
                     root.set_right(del_node(A__							, A__				)				)
              elif left_child is not None:
                     _snake_case       =  left_child
              elif right_child is not None:
                     _snake_case       =  right_child
              else:
                     return None
       elif root.get_data() > data:
              if left_child is None:
                     print("""No such data"""				)
                     return root
              else:
                     root.set_left(del_node(A__							, A__				)				)
       else:  # root.get_data() < data
              if right_child is None:
                     return root
              else:
                     root.set_right(del_node(A__							, A__				)				)

       if get_height(A__				) - get_height(A__				) == 2:
              assert right_child is not None
              if get_height(right_child.get_right()				) > get_height(right_child.get_left()				):
                     _snake_case       =  left_rotation(A__				)
              else:
                     _snake_case       =  rl_rotation(A__				)
       elif get_height(A__				) - get_height(A__				) == -2:
              assert left_child is not None
              if get_height(left_child.get_left()				) > get_height(left_child.get_right()				):
                     _snake_case       =  right_rotation(A__				)
              else:
                     _snake_case       =  lr_rotation(A__				)
       _snake_case       =  my_max(get_height(root.get_right()				)							, get_height(root.get_left()				)				) + 1
       root.set_height(A__				)
       return root


class       _lowerCAmelCase   :







       '''simple docstring'''

       def __init__(self  )					->       None:
              _snake_case       =  None

       def 	lowercase							(self  )					->       int:
              return get_height(self.root  )

       def 	lowercase							(self  ,  UpperCAmelCase  )					->       None:
              print("""insert:""" + str(UpperCAmelCase  )  )
              _snake_case       =  insert_node(self.root  ,  UpperCAmelCase  )

       def 	lowercase							(self  ,  UpperCAmelCase  )					->       None:
              print("""delete:""" + str(UpperCAmelCase  )  )
              if self.root is None:
                     print("""Tree is empty!"""  )
                     return
              _snake_case       =  del_node(self.root  ,  UpperCAmelCase  )





       def __str__(self  ,  )					->       str:  # a level traversale, gives a more intuitive look on the tree
              _snake_case       =  """"""
              _snake_case       =  MyQueue()
              q.push(self.root  )
              _snake_case       =  self.get_height()
              if layer == 0:
                     return output
              _snake_case       =  0
              while not q.is_empty():
                     _snake_case       =  q.pop()
                     _snake_case       =  """ """ * int(math.pow(2  ,  layer - 1  )  )
                     output += space
                     if node is None:
                            output += "*"
                            q.push(UpperCAmelCase  )
                            q.push(UpperCAmelCase  )
                     else:
                            output += str(node.get_data()  )
                            q.push(node.get_left()  )
                            q.push(node.get_right()  )
                     output += space
                     _snake_case       =  cnt + 1
                     for i in range(100  ):
                            if cnt == math.pow(2  ,  UpperCAmelCase  ) - 1:
                                   _snake_case       =  layer - 1
                                   if layer == 0:
                                          output += "\n*************************************"
                                          return output
                                   output += "\n"
                                   break
              output += "\n*************************************"
              return output






def  __SCREAMING_SNAKE_CASE				(  ):
       import doctest

       doctest.testmod()


if __name__ == "__main__":
    _test()
    __lowerCAmelCase												=	AVLtree()
    __lowerCAmelCase												=	list(range(10))
    random.shuffle(lst)
    for i in lst:
        t.insert(i)
        print(str(t))
    random.shuffle(lst)
    for i in lst:
        t.del_node(i)
        print(str(t))

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