Matroid Interview Question

How can I count the number of islands in a 2D array?