defmodule Main do def main do [h, n] = IO.read(:line) |> String.trim() |> String.split() |> Enum.map(&String.to_integer/1) i = 1..(n - 1) |> Enum.map(fn _ -> IO.read(:line) |> String.trim() |> String.to_integer() end) solve(h, i) |> IO.puts() end def solve(h, i) do r = (i |> Enum.count(&(&1 > h))) + 1 [ r, case r |> to_string |> String.last() |> String.to_integer() do 1 -> "st" 2 -> "nd" 3 -> "rd" _ -> "th" end ] |> Enum.join() end end