sherlock and squares problem resolved