I'm an architect student and have a question on combinations. I have a grid of 3 x 3, hence a total of 9 spaces. I have 3 elements to place in this grid.

How many possible ways are there of arranging this elements on this grid ? (order, orientation not important)

First putting the elements each in its own space and secondly allowing the elements at a given moment to "share" one space.

Since I got kind of obsessed with this I went ahead and graphically did all the combinations allowing "sharing", a grand total of 729. How could I have known this before hand ?