






'''simple docstring'''

from collections.abc import Generator







def 					lowercase__				(   )->				Generator[int, None, None]:
      UpperCamelCase						,UpperCamelCase       						=      0, 1
      while True:
            UpperCamelCase						,UpperCamelCase       						=      b, a + b
            yield b







def 					lowercase__				(   __UpperCamelCase = 1000					)->				int:
      UpperCamelCase       						=      1
      UpperCamelCase       						=      fibonacci_generator()
      while len(str(next(UpperCAmelCase__					)					)					) < n:
            answer += 1
      return answer + 1


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








'''simple docstring'''

from math import sqrt







def 					lowercase__				(   __UpperCamelCase					)->				int:
      UpperCamelCase       						=      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 					lowercase__				(   __UpperCamelCase = 10000					)->				int:
      UpperCamelCase       						=      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())))
