First version of single number algorithm