program main
  implicit none
  integer*8 :: i, n, m, nv, cnt = 0
  read *, nv
  n = nv
  cnt = cnt + n - 1
  do i = 2, int(sqrt(dble(n)), kind=8)
    m = nv
    do 
      if (mod(n, i) /= 0) exit
      n = n / i
      m = m / i
      if (m <= i) exit
      cnt = cnt + m - 1
    end do
  end do
  print '(i0)', cnt
end program