For this case we have that by definition, the volume of a rectangular prism is given by:

Where:
It is the area of the base
h: It is the height
So:

The volume of the prism is:

Now, the volume of the cubes is:

Thus, we divide and find the number of cubes to fill the prism:

ANswer:
n = 2.5