counting cubes math