Given a grid containing elements in the set #{0 1}, count the total number of connected groups of 1s.
For example the grid:
0 1 0 0 0
1 0 0 1 0
0 0 0 0 0
0 1 0 0 0
0 1 1 0 0
has 3 groups: #{(1 0) (0 1)}, #{(3 1)}, and #{(1 3) (1 4) (2 4)}