# D Flags

Author: mathforces
Problem has been solved: 63 times

Русский язык | English Language

Dima painted the flags on the different papaers of all countries the names of which begin with the letter D, using the original colors. Further, he cut each paper $X$ into pieces $a_1, a_2, ...., a_n$ so that no piece of $a_i$ contains more than two colors, and in any pair of pieces bordering (before the cut) both pieces do not share a color with each other. Find the number of rectangles among all the pieces. Note: white is also color.