defmodule Main do
    def main do
        n = IO.read(:line)
        |> String.trim
        |> String.to_integer

        ans = 1..n
        |> Enum.map(fn x ->
            cond do
                rem(x, 3) == 0 -> 0
                rem(x, 5) == 0 -> 0
                true -> x
            end
        end)
        |> Enum.sum

        IO.puts ans
    end
end
