number of squares adapts to connections