program main
  implicit none
  integer*8::C,N,i,j,ABGCD
  read *,N
  if(MOD(N,2).eq.0) then
     ABGCD = gcd(2*N,1+N)
     N = N/2
  else
     ABGCD = gcd(N,(1+N)/2)
  end if
  C = 1

  call sub(ABGCD,C)
  call sub(N,C)

  print '(i0)',C

contains
  subroutine sub(N,c)
    integer*8,intent(inout)::N,C
    integer*8::i,j,SQRTN
    integer*1,allocatable::insuu(:)
    SQRTN  =INT(SQRT(DBLE(N)))

    allocate(insuu(SQRTN))
    insuu = 0
    do i=2,SQRTN
       if(insuu(i).eq.1) continue
       do j=i+i,SQRTN,i
          insuu(j) = 1
       end do

       if(MOD(N,i).eq.0) then
          do
             C = (i+1)*C
             N = N/i
             if(MOD(N,i).ne.0) exit
          end do
       end if

       if(N.eq.1) exit
    end do
    if(N.ne.1) C = C*(1+N)
    deallocate(insuu)

  end subroutine sub

  recursive function gcd(a,b) result(c)
    implicit none
    integer*8::a,b,c
    if(b.eq.0) then
       c = a
    else
       c = gcd(b,MOD(a,b))
    end if
  end function gcd
end program main