I have $ n$ elements out of $ n-1$ are distinct. The repeated element is either minimum or maximum element. I need to figure out how many distinct max heaps can be made from it.

*My analysis* : I started with $ n$ distinct elements. Since root is fixed( maximum element) we can choose $ l$ (found using deducting total elements from elements in penultimate level) from remaining $ n-1$ elements and recursively choose for Left Sub-tree and Right Sub-tree.

Recurrence Relation :

$ T(n)={n-1 \choose l} * T(l) * T(r)$

Now for $ n-1$ distinct elements(given), for root we have $ 2$ options i.e. maximum elements and we can recurse as above for left and right sub-tree. But since the repeated element is also there I am not able to figure out exact way to do so.

Eg: $ A=[2,6,6] =>$ There are 2 distinct max heaps $ => [6,2,6] , [6,6,2]$

I am unable to think of the way to find out the number of max heaps in this case. Can someone think of algorithm/recurrence relation to find so ?