improve bool_and and bool_or order O(N) -> O(logN)