Teaser 2975: Hollow cube land

From The Sunday Times, 29th September 2019 [link]

I have a large box of toy building bricks. The bricks are all cubes (the same size), and can be pushed together then dismantled.

I decided to build the largest cube possible by leaving out all the interior bricks. When my hollow cube was finished I had two bricks left over. I put all the bricks back in the box and gave it to my two children. Each in turn was able to use every brick in the box to construct two hollow cubes, again with all interior bricks removed. Their cubes were all different sizes.

This would not have been possible had the box contained any fewer bricks.

How many bricks were in the box?

[teaser2975]