defmodule Main do
  require Integer

  def main do
    n = IO.gets("") |> String.trim() |> String.to_integer()

    div_game(n) |> IO.puts()
  end

  @doc """
  div_game

  ## Examples

      iex> DivGame.div_game(24)
      3
      iex> DivGame.div_game(64)
      3
      iex> DivGame.div_game(1)
      0
      iex> DivGame.div_game(1000000007)
      1
      iex> DivGame.div_game(997764507000)
      7

  """
  def div_game(n) do
    factors = factors_for(n)

    uniq_list = MapSet.new(factors) |> MapSet.to_list()

    (factors -- uniq_list)
    |> Enum.chunk_every(2, 2, :discard)
    |> Enum.count()
    |> Kernel.+(Enum.count(uniq_list))
  end

  def factors_for(number) do
    factorize(number, 2, [])
  end

  defp factorize(number, factor, prime_factors) when number < factor do
    prime_factors
  end

  defp factorize(number, factor, prime_factors) when rem(number, factor) == 0 do
    [factor | factorize(div(number, factor), factor, prime_factors)]
  end

  defp factorize(number, factor, prime_factors) do
    factorize(number, factor + 1, prime_factors)
  end
end