#K48872. Counting Valid Colorings
Counting Valid Colorings
Counting Valid Colorings
You are given an integer (n) representing the number of buildings and a list of (n) integers representing their heights. Although the heights are provided, they do not affect the painting process. The task is to count the number of valid ways to color the buildings so that no two adjacent buildings are painted the same color. For the first building, there are 3 color choices, and for each subsequent building there are 2 choices. Hence, the number of valid colorings is given by the formula: (3 \times 2^{n-1}).
inputFormat
The input consists of a single line containing an integer (n) followed by (n) space-separated integers representing the heights of the buildings. Note that the heights are not used in the calculation.
outputFormat
Output a single integer representing the number of valid ways to color the buildings.## sample
1
2
3
</p>