What a great idea! The reason why we only count the right and down neighbors is that if
one cell has a left or up neighbor, it must have been counted by other cells as their right or down neighbors, and in the end, we just decrease the two sides of those adjacent islands.