Distributes a number of items in a grid