If I have N <= 20 elements, I need to arrange them in some way to satisfy a condition(s), what is the number of arrangements mod 1e9 + 7, where an arrangement is different from another arrangement if at least on element is in different locations in the two arrangements, is there some dp trick to know if an arrangement counted before?? note: in this type of problems arrangement may be counted twice because may it's satisfy conditions in two different ways.