Grouping images by specified number

It's very useful for multiple items carousel or some special markup.