


from math import sqrt

def   _UpperCAmelCase       (     UpperCAmelCase      :			int      ):
      """simple docstring"""




      __lowerCamelCase     :      List[str]       						=						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   _UpperCAmelCase       (     UpperCAmelCase      :			int = 10_000      ):
      """simple docstring"""




      __lowerCamelCase     :      Dict       						=						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())))







def   _UpperCAmelCase       (     ):
      """simple docstring"""




      __lowerCamelCase     :      Optional[int]       						=						[31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]

      __lowerCamelCase     :      str       						=						6
      __lowerCamelCase     :      Optional[int]       						=						1
      __lowerCamelCase     :      Optional[int]       						=						1_901

      __lowerCamelCase     :      Optional[Any]       						=						0

      while year < 2_001:
            day += 7

            if (year % 4 == 0 and year % 100 != 0) or (year % 400 == 0):
                  if day > days_per_month[month - 1] and month != 2:
                        month += 1
                        __lowerCamelCase     :      Tuple       						=						day - days_per_month[month - 2]
                  elif day > 29 and month == 2:
                        month += 1
                        __lowerCamelCase     :      str       						=						day - 29
            else:
                  if day > days_per_month[month - 1]:
                        month += 1
                        __lowerCamelCase     :      Any       						=						day - days_per_month[month - 2]

            if month > 12:
                  year += 1
                  __lowerCamelCase     :      Optional[Any]       						=						1

            if year < 2_001 and day == 1:
                  sundays += 1
      return sundays


if __name__ == "__main__":
    print(solution())



