Bully algorithm implementation in Erlang