defmodule Main do
  use Bitwise
  def main do
    _ = IO.gets("")
    a = IO.gets("")
        |> String.trim()
        |> String.split(" ")
        |> Enum.map(&String.to_integer/1)

    mask = a |> xor()

    a
    |> calc(mask, [])
    |> Enum.join(" ")
    |> IO.puts()
  end

  def xor(a) do
    a |> Enum.reduce(fn x, acc -> x ^^^ acc end)
  end

  def calc([], _, acc), do: acc |> Enum.reverse()
  def calc([x | tail], mask, acc) do
    calc(tail, mask, [x^^^mask | acc])
  end
end
