.
For n x n x n cube
- the number of cubes that have 3 blue faces is 8 // the corner cubes;
- the number of cubes having 2 blue faces is 12*(n-2) // the cubes along 12 edges, without counting the corner cubes;
- the number of cubes having 1 blue face is n^3 - (n-2)^3 - 12*(n-2) - 8.
In the last formula, n^3 - (n-2)^2 is the number of all small cubes minus the number of interior cubes,
that comprise the smaller (n-2)*(n-2)*n-2) cube;
12*(n-2) is the number of cubes along 12 edges that have two faces painted blue;
and 8 is the number of corner cubes, having 3 faces painted blue.
Solved.