Today i tried to solve this problem
the simplified version of the problem is no ways of assigning 2 different objects in n different places. so in this problem 2 different objects are carrot and baby carrot. we are given no of places
we have to print no ways of plant this two different carrots in n places .
how to solve this ?
Number of spanning trees in complete bipartite graph GX, Y is : XY - 1 × YX - 1
X : is the number of nodes in the first set.
Y : is the number of nodes in the second set.
Reference
Now you should sum the answer of every (X,Y)
x = 1, y=n-1
x = 2, y=n-2
...
then multiply it by the number of permutations which is equal to n! because you have n item and all of then are distinguishable.