A unit cube is a 1x1x1 cube, whose corners have integer x, y, and z coordinates. Two unit cubes are connected when they share a face. A 3-dimensional solid object (solid, for short) is a non-empty connected set of unit cubes (see Figure 1). The volume of a solid is the number of unit cubes it contains. A block is a solid with volume at most 4. Two blocks have the same type when one can be obtained from the other by translations and rotations (not reflections). There are exactly 12 block types (see Figure 2). The colors in the figures only help to clarify the structure of the solids; they have no other meaning.
Your program is to read from standard input. The first line contains the volume V of the solid (1 <= V <= 50). The remaining V lines contain three integers x, y, z, being the coordinate triple of its corner that minimizes x + y + z, each identifying one unit cube of the solid (1 <= x, y, z <= 7).
Your program is to write to standard output. The first line must contain one integer M, being the smallest number of blocks into which the input solid can be decomposed.
18 2 1 1 4 1 1 2 3 1 4 3 1 2 1 2 3 1 2 4 1 2 1 2 2 2 2 2 3 2 2 4 2 2 2 3 2 3 3 2 4 3 2 4 2 3 4 2 4 4 2 5 5 2 5
5