defmodule Main do def main do IO.read(:line) |> String.trim() |> String.split() |> Enum.map(&String.to_integer/1) |> solve |> IO.puts() end def solve(rgb) do rgb |> solve_rec(0) end def solve_rec(rgb, x) do case rgb |> Enum.sort() do [0, 0, 0] -> x [0, 0, 1] -> x [0, 1, 1] -> x [0, b, c] -> [1, b, c - 2] |> solve_rec(x) [a, b, c] -> [0, b - a, c - a] |> solve_rec(x + a) end end end