help please

help in writing code to evaluate the foll.

4 : {1 1 1 1 , 1 2 2 , 2 1 2 , 2 2 1 , 1 3 , 3 1} size: 6

3 : {1 1 1 , 1 2 , 2 1} size: 3

2 : {1 1} size: 1

//