taking 1's into account