I assigned number to each shape: circle=0, triangle=1 and square=2. I think used them just like the numbers to count up from (circle circle circle, 000) to max (square, square, square, 222) and resulted in 27 different numbers.
That is the correct number of permutations.