defmodule Main do
  def main do
    _n = IO.gets("") |> String.trim() |> String.to_integer()
    list = IO.gets("") |> String.trim() |> String.split() |> Enum.map(&String.to_integer/1)

    divisible_num(list, list, 0, 0)
    |> IO.puts()
  end

  defp divisible_num(origin_list, [num | []], count, index) do
    {_, target_list} =
      origin_list
      |> List.pop_at(index)

    case Enum.any?(target_list, fn x -> rem(num, x) == 0 end) do
      true ->
        count

      false ->
        count + 1
    end
  end

  defp divisible_num(origin_list, [num | rest], count, index) do
    {_, target_list} =
      origin_list
      |> List.pop_at(index)

    case Enum.any?(target_list, fn x -> rem(num, x) == 0 end) do
      true ->
        divisible_num(origin_list, rest, count, index + 1)

      false ->
        divisible_num(origin_list, rest, count + 1, index + 1)
    end
  end
end