booleans solution

Second part solution