I FOUND YOUR COMPLETE QUESTION IN OTHER SOURCES.
SEE ATTACHED IMAGE.
The problem can be modeled as a pair of matrices:
(4) * (4) = 16
(16) * (5) = 80
Since the second matrix depends on the first, then the number of cubes is:
N = 80