Lexicographic binary encoding