In a square map, 1 represents a cell with a house and 0 represents an empty cell. Two house cells are connected if they touch vertically or horizontally. Cells that touch only diagonally are not connected.
A housing complex is a group of houses connected in this way. Given the map, find the number of complexes and the number of houses in each complex. The complex sizes must be printed in ascending order.
The first line contains the map size N. The map is an N x N square, and 5 <= N <= 25.
The next N lines each contain one row of the map. Each row is a length-N string made only of 0 and 1.
Print the total number of complexes on the first line.
Then print the number of houses in each complex, sorted in ascending order, one per line.