Automatically calculate the number of columns in ColumnFlow